quotes inside #if 0

Richard O'Keefe ok at cs.mu.oz.au
Tue Sep 5 13:50:16 AEST 1989


In article <2014 at munnari.oz.au> ok at cs.mu.oz.au (Richard O'Keefe) writes:
>	#if 0 ... [English text and C examples] ... #endif
>The compiler sees words like "don't" in the English text and snarls that
>these are unterminated character constants.  This used to be perfectly
>good C...

In article <14512 at haddock.ima.isc.com>, karl at haddock.ima.isc.com (Karl Heuer) writes:
> No, what you really mean is that you used to use a compiler that happened not
> to complain about that, and now you use one that does.  The introduction of
> ANSI C between the two events is largely coincidental.  It never was good C.

It is not at all coincidental.  There was never any suggestion in any book
that #if 0-ed code had to have balanced single quotes, and the only C
compiler I've ever come across (I've used about a dozen) that complains
about it is the only one I've used that tries to be ANSI-compliant.
I've even seen the device recommended in this newsgroup (I'd name names,
but I've forgotten them).

There are good reasons why a conditional inclusion facility should not
treat omitted text as tokens (e.g. some new ANSI tokens were not legal
before, like 2U, and some old ones, like 09, aren't legal now, and some
compilers support extended syntax).

For all programming languages X, good comments are good X.



More information about the Comp.lang.c mailing list