Standardization questions -- nested comments
Dick Dunn
rcd at opus.UUCP
Fri Oct 12 11:55:28 AEST 1984
One recent idea was to have an occurrence of "/*" within a comment generate
a warning. I suppose I could live with that as long as I can shut off
the warning (since I would use an alias or some such to disable it all
the time). Another suggestion:
> From: Paul Schauble <Schauble at MIT-MULTICS.ARPA>
>
> Has anyone considered making /* and */ nest properly, so that one could
> comment out commented code??
It bothers me a little that it seems necessary to start complicating the
structure of comments. For C, I really think we can live with what we've
got. 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 --.)
Another approach is to have two forms such as (* *) vs { } in Pascal BUT
don't allow matching (* with } or { with *)--this is clumsier but can be
made to work.
Examining the interior of comments CAN get in the way. Once upon a time
there was a not-quite-brilliant idea that Pascal compilers should make an
effort to detect an unclosed comment. (I think it was in one of the drafts
of the Standard; I have no idea whether it stayed.) This begat some odd
solutions--one of the worst being a compiler warning on any occurrence of a
semicolon within a comment. Of course, if you write normal text in
comments you'll punctuate it and the compiler makes a lot of racket. So
you turn off warning messages and miss all of the nice things like "this
variable is probably used before it is set."
--
Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303)444-5710 x3086
...Relax...don't worry...have a homebrew.
More information about the Comp.lang.c
mailing list