Standardization questions -- nested comments

Dick Dunn rcd at opus.UUCP
Tue Oct 16 10:51:15 AEST 1984


> > From:  William LeFebvre <phil at RICE.ARPA>
> > > Has anyone considered making /* and */ nest properly, so that one could
> > > comment out commented code??
> > The best and most widely accepted way to prevent a block of code from
> > being compiled while still leaving the code in the file is as follows:
> > #ifdef notdef
> The serious problem with no nesting is that whether or not a comment
> will work or net depends on the context.  The #ifdef method is
> ugly, and only works for sure if you never use comments or keep them
> real short...

Ugliness is in the eye of the person who doesn't want to do it that way...
but seriously, what's the problem of interaction with comments?

> ...If there is any chance that a comment may be lurking
> around, one cannot just stick a comment string into a C file without
> checking an arbitrarily large amount of context information to see
> if there is another comment that it will mung.  This sort of global
> checking is just the sort of things I hate to do, but computers are
> good at.  Let's hear it for compiler support for nested comments.

It seems like the argument here is that you want to be able to comment out
code without any attention to the context.  That won't work, and nesting
comments won't help.

Oh, by the way, would one of the comment-nesting advocates care to tell us
whether a comment delimiter in quotes--say "/*"--should be regarded as a
delimiter or not?  Don't consider this one for too long--either answer
leads to annoying situations.
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...Lately it occurs to me what a long, strange trip it's been.



More information about the Comp.lang.c mailing list