Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Programming exercise/challenge Date: Sun, 13 Dec 2020 20:57:32 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: <86r1ntyog3.fsf@linuxsc.com> References: <86wnxwkyol.fsf@linuxsc.com> <2e2013d6-ebb1-4307-b91a-cba5509d2aa6n@googlegroups.com> <590c3899-7fe8-4ef7-83ee-a96165fcab20n@googlegroups.com> <86a6un5l11.fsf@linuxsc.com> <77f507a2-70b5-4143-b4aa-babc4f2a17abn@googlegroups.com> <20201212235625.2ed00d1287b1d48b52d9a68c@gmail.com> <20201213141727.288df3589354d05a3e03b53d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="ff5991e7e84d299f78a176558dfeb7ce"; logging-data="20565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4EQFGaYGjFh5sOkfRBCiS+i3chZTLXcs=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:6SvcUocjrNrTkkIzZwShHqKoH1s= sha1:Fiz3Q5W70TroDa+J406GSdoLvEo= Xref: csiph.com comp.lang.c:157259 luser droog writes: [...] > So, here's my Version 5. [...] > > //strpcom-v5.c: > //$ make strpcom-v5 CFLAGS='-std=c99 -Wall -pedantic -Wextra -Wno-switch' > //#define DEBUG(...) __VA_ARGS__ > #define DEBUG(...) > [...] I'd appreciate it if you would get rid of the DEBUG() macro and find another way of enabling snippets of debugging code that doesn't use the C preprocessor (except perhaps for initializing a controlling variable, eg #ifndef DEBUG_LEVEL #define DEBUG_LEVEL 0 #endif static const int debug = DEBUG_LEVEL; and then test 'debug' later in the code using regular language statements). Also, try this test case (echo foo // blah ; echo bas) | your-executable The output I expect has two lines.