warning: '/*' within comment
Karl Heuer
karl at haddock.ima.isc.com
Thu Jun 7 11:50:25 AEST 1990
In article <371 at necssd.NEC.COM> harrison at 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 at ima.ima.isc.com or harvard!ima!karl), The Walking Lint
More information about the Comp.std.c
mailing list