B
BartC
Kaz Kylheku said:No, because the formal language allowed within the comment excludes the
digraph */ which may occur in the source code of C, inside a string
literal, as part of a comment, or inside a // comment.
Well, yes; I mentioned */ a sentence or two later.
It's more than a style issue; it's a formal language issue. Comments can
only
contain a subset of the possible set of C strings.
It is useful that you can have a subset of C within comments, for
instance,
coding examples. They just can't have /*...*/ comments of their own, which
is
fine since they are already inside a comment which can explain everything.
What you're saying then is that /*...*/ comments are not a suitable
mechanism for commenting out code? The reason being that code might contain
(in perhaps one program in a thousand) a '*/' or "*/" token? Yet everyone
does this, and the world hasn't yet ended.
And perhaps /*...*/ isn't suitable for writing comments, period, since there
will from time to time be content that will break it. For example I couldn't
paste */this sentence/* into such a comment. Yet that doesn't bother many
people either.
A mechanism for commenting out arbitrary code must be robust, period. This
way
it can be applied to a 50,000 line piece of source code without worry that
anything breaks.
#if 0 ... #endif satisfies that requirement.
Only if the code you're trying to 'comment out' is well-formed. If it's
unfinished, has open literals, and unbalanced #endifs scattered about, then
there will be problems. In this case /*...*/ might be a better bet...