home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19870 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.3 KB  |  29 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!haven.umd.edu!wam.umd.edu!krc
  3. From: krc@wam.umd.edu (Kevin R. Coombes)
  4. Subject: Re: Overloading Operators
  5. Message-ID: <1993Jan25.174819.18445@wam.umd.edu>
  6. Sender: usenet@wam.umd.edu (USENET News system)
  7. Nntp-Posting-Host: rac1.wam.umd.edu
  8. Organization: University of Maryland, College Park
  9. References: <727392166snx@trmphrst.demon.co.uk> <C13BK9.Lr@frumious.uucp> <2215@celia.UUCP>
  10. Date: Mon, 25 Jan 1993 17:48:19 GMT
  11. Lines: 16
  12.  
  13. In article <2215@celia.UUCP> celia!gray@usc.edu (Steve Gray) writes:
  14. >A const reference differs in a very important way from a plain reference:
  15. >it clearly states that the member function has no side effects.  One of
  16. >my (and others at R&H's) primary objections to using references is that
  17. >it means member functions can have un-obvious side effects on their parameters. 
  18. >i.e. they can change the contents of a variable which was passed by value (as 
  19. >far as the caller's syntax is concerned) and therefor should not be changed by 
  20. >the member function.
  21. >
  22. >We have basically outlawed non-const references as being too dangerous.  I
  23. >personally would have preferred that they not even be allowed in the language,
  24. >but I can understand why (given the syntax of the language) they are allowed.
  25.  
  26. Have you also outlawed pointers (to non-const objects) as parameters?
  27.  
  28. Kevin Coombes <krc@math.umd.edu>
  29.