Re^2: Why nested comments not allowed?

Todd M. Lewis utoddl at uncecs.edu
Wed Feb 21 03:53:53 AEST 1990


[Sorry, folks.  I started this, now I'll try to end it.  Sure...]
In article <1975.25e0048c at wums.wustl.edu> bethge at wums.wustl.edu writes:
>In article <1990Feb19.143619.17663 at uncecs.edu>, utoddl at uncecs.edu
>(Todd M. Lewis) writes:
>> ... Because we've been doing it that way for eons doesn't mean it's a
>> "better way."  Of course, without true nested comments it's the
>> only way, but that, too, is beside the point. #ifdef/#endif is better
>                                                ^^^^^^^^^^^^^^^^^^^^^^^
>> for conditionally compiling code fragments.  Nested comments are the
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> better way to "comment out a section of code that contains comments."
>> Your own words--it should be obvious.  I am continually amazed that
   [lots of wonderful logic deleted]
>
>This apprears to be a religious issue.  It is not the least bit "obvious" to
>me  that "nested comments are the better way" to suppress the compilation of
>a section of code.  What is this, if not conditional compilation?

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.
  It isn't a religious issue. It is a semantic issue--on two levels, no less.
On the lower level, what I said is not what you thought I meant.  On the
higher level, #ifdef/#endif and nested comments are not the same although
the end result may be the same.
_____        
  |      Todd M. Lewis            Disclaimer: If you want my employer's
  ||\/|  utoddl at ecsvax.uncecs.edu             ideas, you'll have to
  ||  || utoddl at ecsvax.bitnet, @unc.bitnet    _buy_ them. 
   |  || utoddl at sun1.mscre.unc.edu 
       |___   ("Prgrms wtht cmmnts r lk sntncs wtht vwls." --TML)



More information about the Comp.lang.c mailing list