home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 15998 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.9 KB  |  59 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!think.com!sdd.hp.com!spool.mu.edu!umn.edu!hecto.cs.umn.edu!hansen
  3. From: hansen@hecto.cs.umn.edu (David M. Hansen)
  4. Subject: Re: Debugging output
  5. Message-ID: <1992Nov9.235112.2255@news2.cis.umn.edu>
  6. Sender: news@news2.cis.umn.edu (Usenet News Administration)
  7. Nntp-Posting-Host: hecto.cs.umn.edu
  8. Organization: University of Minnesota
  9. References: <spuler.720931050@coral> <Bx9369.3zL@cs.uiuc.edu> <1992Nov6.135017.6870@news2.cis.umn.edu> <BxAz2L.n4M@cs.uiuc.edu>
  10. Distribution: usa
  11. Date: Mon, 9 Nov 1992 23:51:12 GMT
  12. Lines: 45
  13.  
  14. In article <BxAz2L.n4M@cs.uiuc.edu>, pjl@cs.uiuc.edu (Paul Lucas) writes:
  15. |> In <1992Nov6.135017.6870@news2.cis.umn.edu> hansen@deci.cs.umn.edu (David M. Hansen) writes:
  16. |> 
  17. |> >In article <Bx9369.3zL@cs.uiuc.edu>, pjl@cs.uiuc.edu (Paul Lucas) writes:
  18. |> >|> *****>    This is overkill; the same thing can be achieved without
  19. |> >|>     inventing another class:
  20. |> >|> 
  21. |> >|>     #ifdef DEBUG
  22. |> >|>     #    define    CDEBUG    if ( debug ) cerr
  23. |> >|>     #else
  24. |> >|>     #    define    CDEBUG    //
  25. |> >|>     #endif
  26. |> >|> 
  27. |> >|>     // ...
  28. |> >|> 
  29. |> >|>     CDEBUG << "here\n";
  30. |> >|> 
  31. |> >|>     This allows the flexibility of having debugging "togglable"
  32. |> >|>     during development, presumeably by a command-line option, but
  33. |> >|>     can be compiled-out in the final version.
  34. |> >|> 
  35. |> 
  36. |> >I think it is a mistake to rely on what is essentially a bug in many C++
  37. |> >compilers.  According to the ARM (section 16.1, page 370)  "...a single white
  38.  
  39. [ARM reference and example deleted]
  40.  
  41. |> 
  42. |> *****>    I already pointed out that this only works on C++-ignorant
  43. |>     preprocessors; the above example is a well-known pitfall and I
  44. |>     consider it irrelevant.  You always have to do everything
  45. |>     carefully.
  46.  
  47. True, the example is irrelevant.
  48.  
  49. True, you _always_ have to do everything carefully.
  50.  
  51. Perhaps you pointed out that it doesn't always work.  I didn't see it (mea culpa).
  52. This is also irrelevant.
  53.  
  54. It is _still_ a mistake to rely on a bug.
  55.  
  56.                     -=Dave
  57.  
  58.  
  59.