Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!apple!rutgers!mcdchg!att!cbnewsc!dalenber From: dalenber@cbnewsc.ATT.COM (Russel Dalenberg) Newsgroups: comp.lang.c Subject: Re: Why nested comments not allowed? Message-ID: <14075@cbnewsc.ATT.COM> Date: 3 Mar 90 01:22:33 GMT References: <4686@jarthur.Claremont.EDU> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 37 In article <4686@jarthur.Claremont.EDU>, dfoster@jarthur.Claremont.EDU (Derek R. Foster) writes: > If people wish to argue about the aesthetics of nested comments vs. > #ifdef/#endif, that's fine, but arguments like > > "But with nested (or "but with non-nested...") comments, how can I do > printf("/* some horrible abomination with lots of /* and */ */"); > > are NOT MEANINGFUL, since the same problems exist with/without nested > comments, just in different situations! I agree. I only posted my printf example to point out that parsing nested comments would not be "simple". > And it's the code-writer's fault! Well, in the sense that all the code a programmer writes is his "fault", I agree. But I think it's perfectly reasonable to put comment delimiters in a string (and quotes in comments). > 4) If you write code that depends on whether comments are nested or not, > it's not the compiler's fault, it's YOURS, and you deserve what you get! No. Comments in C are *defined* not to nest. It's perfectly reasonable to expect then not to nest, and program accordingly. > Encode /* and */ before putting them in strings! I think this is foolish overkill. It can't hurt your code, but it can make it harder to read and maintain. Russel Dalenberg att!ihlpb!dalenber dalenber@ihlpb.att.com Disclaimer: These are my opinions, not AT&T's