warning: '/*' within comment

diamond@tkovoa diamond at tkou02.enet.dec.com
Mon Jun 11 10:56:41 AEST 1990


In article <1990Jun8.224827.23783 at diku.dk> thorinn at skinfaxe.diku.dk (Lars Henrik Mathiesen) writes:

>If you know of an ANSI C compiler (I don't think it's ``perfectly
>valid'' otherwise) which does not lex #if'fed-out blocks into
>pptokens, please explain how it handles this conformant (I think)
>program:
>#include <stdio.h>
>#if 0
>C's weird\
>#if 1		/* isn't it */
>#else
>int main(int c, char *v[]) { printf("Hello, world!\n"); return 0; }
>#endif

What's the problem?
 #include <stdio.h>
 #if 0
 C's weird#if 1 /* isn't it */
 #else
 int main(int c, char *v[]) { printf("Hello, world!\n"); return 0; }
 #endif
preprocesses to
 [contents of <stdio.h>]
 int main(int c, char *v[]) { printf("Hello, world!\n"); return 0; }
regardless of whether the preprocessor really tokenizes or not the line
 C's weird#if 1 /* isn't it */

-- 
Norman Diamond, Nihon DEC     diamond at tkou02.enet.dec.com
Proposed group comp.networks.load-reduction:  send your "yes" vote to /dev/null.



More information about the Comp.std.c mailing list