Re^2: Why nested comments not allowed?

News system news at ism780c.isc.com
Thu Feb 22 14:22:32 AEST 1990


In article <2037.25e266bf at wums.wustl.edu> bethge at wums.wustl.edu writes:
>OK, I am not understanding you.  Can you enlighten me?  My question is,
>*why* do you want nested comments?  ...

>I know that the *mechanisms* of #ifdef/#endif and nested  comments  are
>different.   But  if the *purpose* is the same, and the *end result* is
>the same, why are both needed?

Not that it is important but #if/#endif cannot be used to 'comment out'
starting in the middle of a line and/or ending at the middle of a line.

Actually, when I 'comment out' it is always for debugging.  In almost every
instance, I also 'comment in' a piece of code.  The method I use (in Unix)
is:

   cp foo.c foo.c.sav
   <munch on foo.c with the editor of my choice>
   cc foo.c
   <try the program>
   mv foo.c.sav foo.c

This is extemely flexible and never results in shipping a 'completed' source
file with what looks like executable code enclosed inside a comment or
#if/#endif.

     Marv Rubinstein



More information about the Comp.lang.c mailing list