Re^4: Why nested comments not allowed?

Russel Dalenberg dalenber at cbnewsc.ATT.COM
Wed Feb 21 05:44:15 AEST 1990


In article <1525 at wacsvax.OZ>, chris at wacsvax.OZ (chris mcdonald):
> dalenber at cbnewsc.ATT.COM (Russel Dalenberg) writes:
>>	printf("A comment is ended with */");
> 
> Ho, hum, now your compiler, lexical analyser can't detect strings either?

I said: how do you handle the case where the above line of legal C is
commented out.  If it's not commented out, there is no problem.

The "usual" way to comment out such code would be:

/*	printf("A comment is ended with */"); */

Since quotes have *NO* significance within comments, the above comment
ends with the first "*/" found; with *both* nested and non-nested comments!


Russel Dalenberg

att!ihlpb!dalenber
dalenber at ihlpb.att.com

Disclaimers: These opinions are mine, all mine!



More information about the Comp.lang.c mailing list