Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Nested Comments in C -- A recent experience Message-ID: <1990Mar27.214157.11512@utzoo.uucp> Organization: U of Toronto Zoology References: <9631@wpi.wpi.edu> <1990Mar18.045238.18224@utzoo.uucp> <5418@jarthur.Claremont.EDU> Date: Tue, 27 Mar 90 21:41:57 GMT In article <5418@jarthur.Claremont.EDU> dfoster@jarthur.Claremont.EDU (Derek R. Foster) writes: >>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!" Me, humble? I was humble once in 1962; I didn't like it and haven't repeated it. :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) >I have been using nested comments as debugging >tools for many years, and I have NEVER had a problem with them. Obviously you never ran into a string containing /*, or the deliberately mismatched comments used for configuration options in some software packages and for debugging by some programmers. As has been explained before, the stuff inside a comment loses all token structure, which makes it much easier to encounter "accidental" comment delimiters. As has been explained before, because nested comments are not standard C, you can expect to find code that relies on comments not nesting. #ifdef has neither problem, and is also rather more conspicuous when somebody else has to read your code. >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. If it's not a completely separate line, it's not likely to have comments inside it, so regular non-nested comments will suffice. >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 */ ... Perhaps you should get a better editor? They do exist. -- Apollo @ 8yrs: one small step.| Henry Spencer at U of Toronto Zoology Space station @ 8yrs: .| uunet!attcan!utzoo!henry henry@zoo.toronto.edu