home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16244 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  1.6 KB

  1. 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
  2. From: pl2440@meibm10.cen.uiuc.edu (Paul Jay Lucas)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Debugging output
  5. Message-ID: <Bxo8v3.A6G@news.cso.uiuc.edu>
  6. Date: 13 Nov 92 20:28:11 GMT
  7. References: <Bx9369.3zL@cs.uiuc.edu> <1992Nov6.135017.6870@news2.cis.umn.edu> <BxAz2L.n4M@cs.uiuc.edu> <83463@ut-emx.uucp>
  8. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  9. Distribution: usa
  10. Organization: University of Illinois at Urbana
  11. Lines: 32
  12.  
  13. In <83463@ut-emx.uucp> jamshid@ut-emx.uucp (Jamshid Afshar) writes:
  14.  
  15. >In article <BxAz2L.n4M@cs.uiuc.edu> pjl@cs.uiuc.edu (Paul Lucas) writes:
  16. >]In <1992Nov6.135017.6870@news2.cis.umn.edu> hansen@deci.cs.umn.edu (David M. Hansen) writes:
  17. >]>>     #ifdef DEBUG
  18. >]>>     #    define    CDEBUG    if ( debug ) cerr
  19. >]>>     #else
  20. >]>>     #    define    CDEBUG    //
  21. >]>>     #endif
  22. >]>>     CDEBUG << "here\n";
  23.  
  24. >]>It is a bug because it means you have to be _very_ careful about how you 
  25. >]>comment your code.  For example, [...]
  26.  
  27. >]*****>    I already pointed out that this only works on C++-ignorant
  28. >]    preprocessors; the above example is a well-known pitfall and I
  29. >]    consider it irrelevant.  You always have to do everything
  30. >]    carefully.
  31.  
  32. >The only thing irrelevant here are your continued assurances that it
  33. >works on some broken C++ implementations.  So what?  Your code is
  34. >wrong.  Why even present, much less defend, your solution?
  35.  
  36.     Because I had a sneaky suspicion that someone else would fix it;
  37.     Graham Dumpleton suggested:
  38.  
  39.     ...
  40.     #else
  41.     #    define    CDEBUG if (0) cerr <<
  42.     #endif
  43.  
  44.     and the code would be optimized away.
  45.