home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
- From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
- Subject: Re: Overloading Operators
- Message-ID: <9302623.13017@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Computer Science, University of Melbourne, Australia
- References: <C0tH6M.FrM@cs.uiuc.edu> <1993Jan13.150525.20916@mobil.com> <727392166snx@trmphrst.demon.co.uk> <C13BK9.Lr@frumious.uucp> <2215@celia.UUCP>
- Date: Tue, 26 Jan 1993 12:08:25 GMT
- Lines: 28
-
- gray@celia.UUCP (Steve Gray) writes:
-
- >> 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.
-
- The term "const reference" was being used in this thread to indicate
- int & const ref
- not
- const int & ref
- So it doesn't indicate that the object referred to is not changed.
-
- I agree with the earlier statements that const references don't differ from
- plain references. But I can see that a volatile reference might differ from
- a plain reference, although I see no useful way of using this difference.
-
- int i;
- int & volatile ref = i; // 'volatile' here prevents compiler
- // from optimizing away 'ref' if
- // it is not used?
-
- --
- Fergus Henderson fjh@munta.cs.mu.OZ.AU
- This .signature virus is a self-referential statement that is true - but
- you will only be able to consistently believe it if you copy it to your own
- .signature file!
-