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: Mon, 11 Jan 2021 06:58:56 -0800
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <86czybpljj.fsf@linuxsc.com>
References: <86wnxwkyol.fsf@linuxsc.com> <864kjwrp0i.fsf@linuxsc.com> <86zh1nqx8r.fsf@linuxsc.com> <4ed1bfed-173f-4aef-ad7b-0e0970860c80n@googlegroups.com> <20210105090706.531@kylheku.com> <78fdc5df-a4e2-40f0-ae4e-48741d331faen@googlegroups.com> <2DaJH.72833$kZ1.12267@fx37.iad> <86d52273-f9eb-45a3-8a8d-5a106679d1c8n@googlegroups.com> <97ebd421-8f0f-4621-bdb9-96d655ba9d9an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="e003f7479dce81a6c34051fbd9d3e250"; logging-data="2676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tKw29VaJgnfKvt0Vde3p8GkF7l+OonAI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:c22x+Uslk5cA6wTsoqH70D7Xxwg= sha1:DBb5n6SLiPYIKUeLwQLRMnuOcMw=
Xref: csiph.com comp.lang.c:158287
Dave Dunfield writes:
> Another "good nights sleep" and I woke realizing that there would
> still be problem with: (Tested and GCC accepts it)
> ---------------
> #define foo "\\
> \
> "/*"
> ---------------
I observe that the new program handles this case correctly (with
some diagnostics issued).
> The fix is not only simple, but reduces the number of lines in my
> "solution". sigh... seems this might never end! :)
If changes always reduce the number of lines, then surely it has
to end sometime. :)
> [..program source..]
It appears the program does not consider the possibility of line
escape sequences as part of comments. Some examples:
================
/\
* This is a comment */
================
/* This is a comment *\
/But this is not a comment /**/
================
/\
/ This is a comment
This line is not a comment
================
// blah blah blah \
This is part of the same comment \
This too is part of the same comment
This line is not a comment
================
Try using gcc -E as a basis for comparison.