nested comments
pcf at drux3.UUCP
pcf at drux3.UUCP
Wed Oct 17 02:55:50 AEST 1984
> ... 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
More information about the Comp.lang.c
mailing list