Re^2: Why nested comments not allowed?
Ted Ying
ted at welch.jhu.edu
Sat Feb 24 02:04:41 AEST 1990
In article <1990Feb20.165353.14212 at uncecs.edu> utoddl at uncecs.edu (Todd M. Lewis) writes:
>
>You have quite precisely missed my point. It was even in quotes. Briefly:
> 1) "comment out a section..." Use comments.
> 2) "compile if x {not} defined" Use #if{n}def/#endif.
>See the difference? In particular, I did not say that nested comments are
>the better way to suppress the compilation of a section of code. If it's a
>comment it isn't code! The notion of conditionally compiling comments is
>a bit off the mark, IMHO. Comments are never compiled--nothing conditional
>about that. Lexed or parsed maybe, but not compiled.
>
OK, Todd. I understand the difference that you are pointing out.
The point you seem to be making is that comments should be
restricted to non-code. However, in that case, you are usually
entering text or pseudo-code or something description or important
to the section of code. In that case, why would you ever want
nested comments? I think that nested comments are needed only if
you would like to be able to "comment" out a section of code that
might have comments in it otherwise. If that is the case, then
it is more appropriate to use #ifdef/#endif. I'm not saying that
nested comments are useless, just that they are not necessary
especially when compared with the cost for generating a nested
comment parser.
Ted Ying ted at welch.jhu.edu
#include <std.disclaimer.h>
Approximating the Taylor series:
Mike Todd + Eddie Fisher + Richard Burton + John Warner + ...
More information about the Comp.lang.c
mailing list