Want a way to strip comments from a

John Rupley rupley at arizona.edu
Fri Mar 24 09:26:24 AEST 1989


In article <1179 at masscomp.UUCP>, ftw at masscomp.UUCP (Farrell Woods) writes:
>In article <9833 at megaron.arizona.edu> rupley at arizona.edu (John Rupley) writes:
>>This one fails, too.  Try:
>>	/***/ hi there /**/
>
>Shouldn't it be a requirement that the program to be stripped at least compile?
>This example will generate a syntax error.

Aw, c'mon... be imaginative... replace "hi there" by a proper statement or
whatever:

	/***/ main() {printf("hi there\n");} /**/

Cpp strips the comments (properly) and passes the program text.  The buggy
C code, which was being discussed in the previous posting, strips everything.
Both of the earlier Lex postings do it right, which would seem to be the
take-home lesson.

John Rupley
rupley!local at megaron.arizona.edu



More information about the Comp.lang.c mailing list