Nested Comments in C -- A recent experience

Will Crowder will at kfw.COM
Thu Mar 15 02:21:55 AEST 1990


In article <90150 at elsie.UUCP> ado at elsie.UUCP (Arthur David Olson) writes:
>> ANSI C (draft of Oct 88) says...that comments do not nest.
>> Detection of /* within a comment is mentioned as a "common warning"...
>
>The "comments do not nest" statement is in a footnote;
>the /* "common warning" statement is in an appendix;
>neither is part of the ANSI standard.

The fact that the statement "comments do not nest" is in a footnote does
indeed mean that that statement is not part of the Standard.  However,
the Standard does contain explicit language indicating that comments
do not nest.

The verbiage:

Section 3.1.9 Comments:

	Except within a character constant, a string literal, *or a comment*,
the characters /* introduce a comment.  The contents of a comment are 
examined only to identify multibyte characters and find the characters
*/ that terminate it.

December 7, 1988 Draft ANSI Standard for the 'C' Programming Language

[emphasis added]

Now I don't know about the rest of you net.folks out there, but haven't
we hashed this around *quite enough* by now?  Face it, comments do *not*
nest in the 'C' language, never have, and probably never will.  This does
not introduce, in my opinion, any more problems than would allowing comments
to nest.  It is simply a fact of the language, and is probably not worth
any more net.bandwidth.  I have directed this article to comp.lang.c instead
of the poster, because there are apparently quite a few folks out there
who can't deal with these facts.  Followups to /dev/null... 

>-- 
>	Arthur David Olson   ado at alw.nih.gov   ADO is a trademark of Ampex.

Will



More information about the Comp.lang.c mailing list