Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!think!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c Subject: Re: warning: '/*' within comment Message-ID: <16811@haddock.ima.isc.com> Date: 7 Jun 90 01:50:25 GMT References: <1990Jun1.200433.6919@druid.uucp> <16786@haddock.ima.isc.com> <371@necssd.NEC.COM> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 27 In article <371@necssd.NEC.COM> harrison@necssd.NEC.COM (Mark Harrison) writes: >[Karl Heuer writes:] >>The contents [of #if...#endif] are still lexed into C tokens, which is why >>it's also illegal to say #if 0...The compiler won't like this...#endif > >Are you sure about this? I tried your example, and it both compiled and >linted. Yes, I'm sure. You just happen to be using a preprocessor that chooses to recover from the error of an unterminated character constant by silently resetting the lexical state at the newline. >If this is true, then the following should also not work: > #if MICROSOFT > extern far char * x; /* however it's done */ > #endif > #if VMS > extern char * x$something; /* however it's done */ > #endif Does not follow. The tokenizing that continues to occur through excluded code is the same as normal; it sees the `/*...*/' as a comment. The `$' is a more interesting case, but I'll factor it out into a separate article. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint