quotes inside #if 0

Richard O'Keefe ok at cs.mu.oz.au
Thu Sep 7 19:32:53 AEST 1989


[I wrote]
: >> #if 0 ... [English text and C examples] ... #endif
: >>The compiler sees words like "don't" in the English text and snarls that
                                  ^^^^^
: >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
                                  ^^^^^^^^^^^^^^^^^^^^^^

In article <766 at ecrcvax.UUCP>, diomidis at ecrcvax.UUCP (Diomidis Spinellis) writes:
> Vanilla pcc complains about unbalanced comments and undefined preprocessor
                              ^^^^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^^^^^^^
> controls inside #if 0 blocks.

I wasn't whining about unbalanced comments, just English text like "don't".
The bottom line is that my belief that #if 0 used to work in C is wrong, I
had just been lucky in never running into any of the nasty bits, and there
isn't any safe way of including large chunks of text in a C program.  Gad,
this makes F-----N look good.  To think that C is a descendant of BCPL,
which had //end-of-line comments.



More information about the Comp.lang.c mailing list