[net.lang.c] nested comments

dalka (11/22/82)

The only reason I can see for nesting comments to provide a way to
quickly and easily "comment out" a block of code. However this can also
be accomplished by:

#if 0
	
	stuff

#endif

However, I've noticed that lint refuses to recognize the #if for some
strange reason while recognizing others in the same compilation!
I'd like to hear the reason for this one!

				Ken Dalka
				ihuxe!dalka

pcf@drux3.UUCP (10/16/84)

> ...  In another language design, there are probably better ways to
> go--such as Ada's "--" which is ALWAYS terminated at end of line.
> (Commenting out a section of code is easy; just prefix each line with --.)

# ifdef ignore

Assuming that you have at most, one comment ending per line, then 
isn't prefixing each line with '/*' just as easy as '--'.

( O.K. so you have to put a '*/' at the end of the block. )

# endif

BCPL (parent of C) has both '/*'..'*/' block comments  and  '//' to end of
line comments.  One tends to use '/*'..'*/' for long comments and '//' for
in-line mixed code and comment. Hence you can use '/*' .. '*/' to comment
out a block of code that has '//' comments. In many years of using BCPL, I
never had any problem with nesting comments and do not know if block comments
nest. I think that '//' would be a useful, compatible, etc addition to C.

	/*
	for( ;; )
	{
		switch(c)
		{
		case 0:	break;		// continue loop
		case 1:	continue;	// break out of loop
		}

		break;	// continue with rest of program
	}
	*/


Peter C. Fry
drux3!pcf

chuck@dartvax.UUCP (Chuck Simmons) (10/19/84)

/* /* */ */

I was reading a C program the other day, and I found a comment in
it.  Yup.  I can see why one might worry about how to comment out
this one line of code with a comment in it.    :-)

-- Chuck
dartvax!chuck

gino@voder.UUCP (Gino Bloch) (10/26/84)

*** REPLACE THIS LINE WITH A BLANK LINE ***

> nest. I think that '//' would be a useful, compatible, etc addition to C.
                ...
> 		case 0:	break;		// continue loop
                ...
> Peter C. Fry
> drux3!pcf

I like this idea very much.
-- 
Gene E. Bloch (...!nsc!voder!gino)