home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!portal!lll-winken!fnnews.fnal.gov!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!meibm10.cen.uiuc.edu!pl2440
- From: pl2440@meibm10.cen.uiuc.edu (Paul Jay Lucas)
- Newsgroups: comp.lang.c++
- Subject: Re: Debugging output
- Message-ID: <Bxo8v3.A6G@news.cso.uiuc.edu>
- Date: 13 Nov 92 20:28:11 GMT
- References: <Bx9369.3zL@cs.uiuc.edu> <1992Nov6.135017.6870@news2.cis.umn.edu> <BxAz2L.n4M@cs.uiuc.edu> <83463@ut-emx.uucp>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Distribution: usa
- Organization: University of Illinois at Urbana
- Lines: 32
-
- In <83463@ut-emx.uucp> jamshid@ut-emx.uucp (Jamshid Afshar) writes:
-
- >In article <BxAz2L.n4M@cs.uiuc.edu> pjl@cs.uiuc.edu (Paul Lucas) writes:
- >]In <1992Nov6.135017.6870@news2.cis.umn.edu> hansen@deci.cs.umn.edu (David M. Hansen) writes:
- >]>> #ifdef DEBUG
- >]>> # define CDEBUG if ( debug ) cerr
- >]>> #else
- >]>> # define CDEBUG //
- >]>> #endif
- >]>> CDEBUG << "here\n";
-
- >]>It is a bug because it means you have to be _very_ careful about how you
- >]>comment your code. For example, [...]
-
- >]*****> I already pointed out that this only works on C++-ignorant
- >] preprocessors; the above example is a well-known pitfall and I
- >] consider it irrelevant. You always have to do everything
- >] carefully.
-
- >The only thing irrelevant here are your continued assurances that it
- >works on some broken C++ implementations. So what? Your code is
- >wrong. Why even present, much less defend, your solution?
-
- Because I had a sneaky suspicion that someone else would fix it;
- Graham Dumpleton suggested:
-
- ...
- #else
- # define CDEBUG if (0) cerr <<
- #endif
-
- and the code would be optimized away.
-