Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Nested Comments in C -- A recent experience Message-ID: <16274@haddock.ima.isc.com> Date: 25 Mar 90 23:42:18 GMT References: <9631@wpi.wpi.edu> <1990Mar18.045238.18224@utzoo.uucp> <5418@jarthur.Claremont.EDU> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 24 In article <5418@jarthur.Claremont.EDU> dfoster@jarthur.Claremont.EDU (Derek R. Foster) writes: >In article <1990Mar18.045238.18224@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) 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!" FACT: any modern C compiler will support #if...#endif, whereas comment nesting is a local hack that happens to work on YOUR compiler. In this sense, at least, #if...#endif is a better choice. Now, GIVEN that you like to program in a dialect that supports both #if...#endif and comment nesting, and that you don't care about porting code containing nested comments to Standard C, I suppose it's a matter of opinion which one works better. My OPINION is that #if...#endif is still a better choice, since it avoids having to worry about how the local dialect handles quote-and-comment mixing, and since it allows me to specify a condition to enable/disable the section of code without having to edit the program source. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint