home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!celia!gray
- From: gray@celia.UUCP (Steve Gray)
- Newsgroups: comp.lang.c++
- Subject: Re: Overloading Operators
- Message-ID: <2215@celia.UUCP>
- Date: 24 Jan 93 00:07:56 GMT
- References: <C0tH6M.FrM@cs.uiuc.edu> <1993Jan13.150525.20916@mobil.com> <727392166snx@trmphrst.demon.co.uk> <C13BK9.Lr@frumious.uucp>
- Reply-To: celia!gray@usc.edu (Steve Gray)
- Organization: Rhythm & Hues, Inc., Hollywood
- Lines: 14
-
- > Like Nikki, I can't think of any way in which a const or volatile
- > reference differs from a plain reference. Is there a difference?
-
- A const reference differs in a very important way from a plain reference:
- it clearly states that the member function has no side effects. One of
- my (and others at R&H's) primary objections to using references is that
- it means member functions can have un-obvious side effects on their parameters.
- i.e. they can change the contents of a variable which was passed by value (as
- far as the caller's syntax is concerned) and therefor should not be changed by
- the member function.
-
- We have basically outlawed non-const references as being too dangerous. I
- personally would have preferred that they not even be allowed in the language,
- but I can understand why (given the syntax of the language) they are allowed.
-