Standardization questions -- nested comments

Mark Weiser mark at tove.UUCP
Sun Oct 14 12:08:41 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.  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.
-- 
Spoken: Mark Weiser 	ARPA:	mark at maryland
CSNet:	mark at umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark
U.S.: Computer Science Dept., University of Maryland, College Park, MD 20742



More information about the Comp.lang.c mailing list