Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "C's Biggest Mistake" Date: Sat, 14 Apr 2018 12:51:17 -0700 Organization: None to speak of Lines: 55 Message-ID: References: <6zpxC.75432$bz1.69868@fx01.iad> <%6sxC.621528$Ml.294897@fx24.am4> <85txC.105783$q15.11321@fx34.iad> <_MIzC.1013644$Ly1.422539@fx13.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="743d05f7c22630af08c03e909762d877"; logging-data="23344"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2oY3ja+kVluAm+YLOgJgb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:qNDqcnKyyfdD7GgOH8ELmYY9EYk= sha1:KohR/Ao1yDcdNY5P5Lpu9hvgKIw= Xref: csiph.com comp.lang.c:129206 jameskuyper@verizon.net writes: > On Saturday, April 14, 2018 at 12:34:50 PM UTC-4, Richard Damon wrote: > ... >> had to chose. My memory of K&R was that its wording, while not >> definitive, leaned more to non-nesting, and I think that was more common >> (the wording being basically that you start at the /* and ignore >> everything until you stop at the next */, with no mention that the stuff >> you are ignoring might include a nested comment. > > 123456789012345678901234567890123456789012345678901234567890123456789012 > K&R, 1st edition, Appendix A 2.1 "Comments" says "The characters /* > introduce a comment, which terminates with the characters */. Comments > do not nest." The 1974 and 1975 C manuals both say: The characters /* introduce a comment, which terminates with the characters */. which implies that they don't nest. The B manual says: Comments are delimited as in PL/I by /* and */. A PL/I grammar I found says: comments = "/*" [ text ] "*/" "text" is not defined, but presumably it can include "*/", which again implies that comments do not nest. The definition *could* have been changed at any time to allow nesting, but it was never considered to be necessary. Incidentally, I have seen a coding style that depends on comments *not* nesting. You might have these lines: puts("line one"); /* line one */ puts("line two"); /* line two */ puts("line three"); /* line three */ and if you want to comment out line two, you can insert a single comment delimiter: puts("line one"); /* line one */ /* puts("line two"); /* line two */ puts("line three"); /* line three */ I'm not saying that this is a particularly good idea, but it does exist. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"