home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11711 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.4 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mole-end!mat
  3. From: mat@mole-end.matawan.nj.us
  4. Subject: Re: const on pass by value
  5. Message-ID: <1992Jul28.180713.16258@mole-end.matawan.nj.us>
  6. Organization: :
  7. References: <1992Jul24.151010.11969@PacBell.COM> <9220801.5026@mulga.cs.mu.OZ.AU>
  8. Date: Tue, 28 Jul 1992 18:07:13 GMT
  9. Lines: 28
  10.  
  11. In article <9220801.5026@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  12. > mat@uunet.uu.net!mole-end writes:
  13. > >In article <1992Jul24.151010.11969@PacBell.COM>, pjcondi@lepton (Paul Condie) writes:
  14. > >> Should pass by value arguments be declared as "const" for
  15. > >> good coding style?  Or is that nit picking?
  16.  
  17. > >> void foo (const int a);
  18. > >> or
  19. > >> void foo (int a);
  20. > >
  21. > >It's not nitpicking.  It's part of something called const correctness.
  22. > >Your program has it or doesn't.  Programs that have it are almost immune
  23. > >to a certain large family of errors.
  24.  
  25. > Huh? In this example, it IS just nitpicking.  How could the presence or
  26. > absence of const in the declaration for foo affect the program's const
  27. > correctness?
  28.  
  29. It affects what version of overloads are applied to the variable/object
  30. and the confidence of the reader that the variables are/are not changed.
  31.  
  32. Everything that _can_ be  const  _should_ be  const .
  33. -- 
  34.  (This man's opinions are his own.)
  35.  From mole-end                Mark Terribile
  36.  
  37.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  38.