Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!rutgers!mcnc!decvax.dec.com!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: C, embedded comments and preprocessors Message-ID: <18081@haddock.ima.isc.com> Date: 20 Sep 90 03:53:32 GMT References: <9009191929.AA13849@lilac.berkeley.edu> <1990Sep20.000536.19987@ccu.umanitoba.ca> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 33 In article <1990Sep20.000536.19987@ccu.umanitoba.ca> mills@ccu.umanitoba.ca (Gary Mills) writes: >lwv27@CAS.BITNET writes: >>I have for some time commented out portions of code by surrounding them by >>a construct similar to: [attempt to use /* ... /* ... */ ... */] No offense, but I'm astounded that some people think nested comment-parsing is normal behavior. (Whether it *should* be is irrelevant. The fact is that it isn't and never has been%.) >A better way to remove some code from the compilation is with: > #ifndef OLD_STUFF > lines of code /* line comment */ > lines of various text's comments > lines of code /* line comment */ > #endif No, that still won't work$. The middle line of those three was commentary rather than code, and the apostrophe is still an unclosed character constant. The correct solution is to use /*...*/ for comments and #if...#endif for code removal, e.g. #if 0 lines of code /* line comment */ /* lines of various text's comments */ lines of code /* line comment */ #endif Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint ________ % Don't bother telling me it works in *your* compiler. I don't care; it still isn't legal. $ See previous footnote.