Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!sdd.hp.com!ucsd!ames!haven!decuac!shlump.nac.dec.com!tkou02.enet.dec.com!diamond From: diamond@tkou02.enet.dec.com (diamond@tkovoa) Newsgroups: comp.std.c Subject: Re: warning: '/*' within comment Message-ID: <1783@tkou02.enet.dec.com> Date: 13 Jun 90 02:15:35 GMT References: <1990Jun1.200433.6919@druid.uucp> <16786@haddock.ima.isc.com> <371@necssd.NEC.COM> <1774@tkou02.enet.dec.com> <1990Jun8.224827.23783@diku.dk> <1777@tkou02.enet.dec.com> <1990Jun12.222745.3015@diku.dk> Reply-To: diamond@tkou02.enet.dec.com (diamond@tkovoa) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 30 In article <1990Jun12.222745.3015@diku.dk> thorinn@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 >#if 0 >I'll put a /* inside 's >#endif >#if 1 >Now it's a */. This program doesn't use comments. >#else >int main(int c, char *v[]) { printf("Hello, world!\n"); return 0; } >#endif This is not a conformant program. If processed by an ANSI C compiler, here is the result of preprocessing: [contents of ] Now it [character constant] t use comments. There isn't necessarily whitespace next to the character constant, and we don't know if brute-force tokenization actually occurs. We still don't know if the preprocessor really tokenizes the if'ed-out lines, aside from recognizing characters, strings, and comments: I [character constant] s int main(int c, char *v[]) { printf( [string constant] ); return 0; } -- Norman Diamond, Nihon DEC diamond@tkou02.enet.dec.com Proposed group comp.networks.load-reduction: send your "yes" vote to /dev/null.