request for C comment stripper

Leo de Wit leo at philmds.UUCP
Thu Mar 23 17:43:01 AEST 1989


In article <5695 at ux.cs.man.ac.uk> ian at mucs.UUCP (Ian Cottam) writes:
|According to my understanding of the pANS C preprocessor and the
|notion of a "translation unit", your example is erroneous as the
|comment must be terminated within startcom.h.  (As a practical
|man I also confirmed my suspicion with the help of gcc :-) )

OK, if your stripper is pANS conforming (whatever that means) it
should handle trigraphs too (it doesn't). If it isn't, then, being
a practical man, try and test my sample program on an Ultrix 2.x C
compiler (4.3 BSD will probably do too). It'll compile just fine.

|However, I suspect someone can come up with a case that will
|throw my lex script as comment-strippers always require more
|thought than people can believe possible.

That's exactly the point I'm trying to make all the time: it shouldn't
be difficult, it isn't entirely trivial however (it may even depend on
the version of pANS you're reading; look for instance for /* in include
file names, compare the Feb '87 and May '88 drafts).

   Leo.



More information about the Comp.lang.c mailing list