Nested Comments in C -- A recent experience
Derek R. Foster
dfoster at jarthur.Claremont.EDU
Mon Mar 26 07:42:37 AEST 1990
In article <1990Mar18.045238.18224 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <9631 at wpi.wpi.edu> msau at wpi.wpi.edu (Matt Saucier) writes:
>>... Although I don't use the nested comment
>>method (I use #ifdef DEBUG #endif (or whatever)), I know a lot of people who
>>do use them....
>
>As has been explained at length, several times, this is a thoroughly bad
>idea that programmers eventually learn to avoid. It simply doesn't work
^^^^^^^^^^^^^^^^^^^^^^
>as well as #ifdef.
^^^^^^^^^^^^^^^^^
You forgot to add "IN MY HUMBLE (or maybe not so humble, considering the
above statement) OPINION!" I have been using nested comments as debugging
tools for many years, and I have NEVER had a problem with them. The only
problem I have had is with people like you telling me I SHOULD have
problems with them, and telling me I shouldn't use them because YOU
think I'll have problems with them. (Which has not happened yet.)
I HAVE had problems with #ifdef and #endif -- they're a lot more trouble
to use when what I'm debugging is not a completely separate line. Not
to mention that I can't have my editor jump to matching #ifdef and #endif
pairs, regardless of nesting, like I can with /* and */ (I just position
the cursor, press ctrl-q-[, and it finds the matching /* or */) All in all,
when I hear you telling me "it simply doesn't work as well", and I consider
my own experiences with the above facts, my first inclination is to laugh
in your face. I have saved myself a TREMENDOUS amount of time by not using
#ifdef and #endif when I don't think they are necessary. You may think nested
comments aren't worth the trouble, but that's just YOUR OPINION. Say "_I_
haven't found it as easy to use, and _I_ think #ifdef and #endif are bettter"
Other people may have had different experiences.
>MSDOS, abbrev: Maybe SomeDay | Henry Spencer at U of Toronto Zoology
>an Operating System. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
Derek Riippa Foster
More information about the Comp.lang.c
mailing list