From: Michael O'Reilly (oreillym@tartarus.uwa.edu.au)
Date: 04/14/93


From: oreillym@tartarus.uwa.edu.au (Michael O'Reilly)
Subject: Re: Possible gotcha in gcc
Date: 15 Apr 1993 03:07:58 GMT

william E Davidsen (davidsen@ariel.crd.GE.COM) wrote:
: I noted an interesting behavior in gcc last night, it doesn't ignore
: stuff which is #ifdef'd out! I got a program to port to Linux, and I had
: some text included which I found valuable. Having learned long ago that
: putting /*...*/ around arbitrary stuff might be a problem due to */ in
: the text, I put #if 0 ... #endif around it instead. A gcc generated
: error messages about the text it should have been ignoring!

: Obviously the preprocessor has to scan for #commands, but it shouldn't
: be complaining about other things in the text, like over-long strings,
: etc. This *may* be an enhancement of the Linux version, since the
: V.4/386 and Sun versions of gcc don't complain about the problem.

Are they the same version of GCC?

: Therefore I want to check it carefully before I report it to the
: developers as a generic bug in gcc.

Read the ANSI standard. The C preprocessor deals with TOKENS!! It
is a requirement that your program be entirely composed to legal
tokens, if they have been #if 0'ed out. GCC comforms where possible
and sensible to the ansi standard.

Check the various FAQ's. I think this is mentioned in the
comp.lang.c FAQ.

: bill davidsen, GE Corp. R&D Center; Box 8; Schenectady NY 12345
Michael