Re: Why don't C comments nest?



On Fri, 13 Jul 2007 00:33:08 -0700, Al wrote:

Hi all,

(Apologies if this is in a FAQ somewhere, I couldn't find anything).

Almost every time I do any significant amount of coding in C or C++, I
end up wishing C-style comments would nest. It would make rapid
debugging much more convenient (vs. #if 0/#endif or editor macros).

Anyway, was this an explicit design decision, or some sort of historical
artifact? (e.g. too expensive to parse at the time).
I don't think that's the reason. I've never written a
preprocessor, but I think that to enable nested comments one would
just need a counting variable incremented for each /* and
decremented for each */, instead of a Boolean variable set and
reset. You might add a translation limit of "32767 nested
comments".

But they wouldn't be that useful. I agree with DTA.
--
Army1987 (Replace "NOSPAM" with "email")
"Never attribute to malice that which can be adequately explained
by stupidity." -- R. J. Hanlon (?)

.



Relevant Pages

  • Why dont C comments nest?
    ... (Apologies if this is in a FAQ somewhere, ... Almost every time I do any significant amount of coding in C or C++, I end up wishing C-style comments would nest. ... Anyway, was this an explicit design decision, or some sort of historical artifact? ...
    (comp.lang.c)
  • Re: Mens Hour Books
    ... Apologies for apparently breaking your rules. ... and hoped this FAQ might help you find your feet faster. ... Some people might complain that you spammed -- you didn't, technically, ... Google Groups doesn't make it obvious how to do this, ...
    (rec.arts.sf.composition)
  • Re: dh, the daemon helper
    ... even if you weren't coding at a CS-student level (apologies ... to any CS students out there, but I've seen worse, I believe), you would never ...
    (comp.lang.c)
  • Re: Is This Story Unpublishable?
    ... please accept my sincere apologies. ... You got everything sorted out before I arrived to post the Newcomer FAQ, ... Google Groups doesn't make it obvious how to do this, ... Thank you for reading this far. ...
    (rec.arts.sf.composition)
  • batching port builds
    ... Apologies if this is in a FAQ, ... How does one tell the ports system to not query interactively for input, ... "Any intelligent fool can make things bigger and more complex... ...
    (freebsd-questions)

Loading