From: utzoo!decvax!cca!dan@BBN-UNIX@sri-unix Newsgroups: net.unix-wizards Title: Re: Comments in C Article-I.D.: sri-unix.4367 Posted: Wed Nov 24 02:19:42 1982 Received: Thu Nov 25 12:17:36 1982 From: Dan Franklin Date: 23 Nov 1982 0:47:28 EST (Tuesday) I think the subject's been just about beaten to death, but: yes, whether comments nest or not, a friendly compiler can point out a problem ('unterminated comment at line #' or 'comment within comment at line #'), and an unfriendly compiler can be equally useless either way. I do not believe that if comments nested, cc would necessarily diagnose errors for you; as evidence I submit the fact that although #if and #endif nest, if you forget an #endif the V7 preprocessor gives you the "silent treatment" that UNIX is so justly famed for. (It is also slightly more difficult to handle nested comments correctly, since you have to keep a stack of starting comment line numbers, but of course anyone who sets out to write a compiler shouldn't find that particularly daunting!) If anyone is seriously thinking of changing the compiler, I really think that changing it to warn about comments within comments, rather than changing it to make comments nest, is more appropriate--compatibility being a lot more important than immediate convenience. But the right place to put such a check is probably in lint, given the current situation. Dan