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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!siena!mittle
  3. From: mittle@watson.ibm.com (Josh Mittleman)
  4. Subject: Re: const on pass by value
  5. Sender: news@watson.ibm.com (NNTP News Poster)
  6. Message-ID: <1992Jul24.172325.25348@watson.ibm.com>
  7. Date: Fri, 24 Jul 1992 17:23:25 GMT
  8. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  9. References:  <1992Jul24.151010.11969@PacBell.COM>
  10. Nntp-Posting-Host: siena.watson.ibm.com
  11. Organization: IBM T.J. Watson Research Center
  12. Lines: 19
  13.  
  14. In article <1992Jul24.151010.11969@PacBell.COM>, pjcondi@lepton (Paul
  15. Condie) writes:
  16.  
  17. > Should pass by value arguments be declared as "const" for
  18. > good coding style?  Or is that nit picking?
  19.  
  20. A blanket convention makes no sense.
  21.  
  22. For scalar arguments, it doesn't really matter: The user can see that the
  23. argument is passed by value, so he doesn't care whether or not it is const.
  24. If you find it convenient, make it a const.
  25.  
  26. For struct or class arguments, it may make a difference, and it is
  27. important to tell the user whether you will change the argument or not.
  28. Use const appropriately.
  29.  
  30. ===========================================================================
  31. Josh Mittleman (mittle@watson.ibm.com)
  32. J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY  10598
  33.