Re: equality of references
On May 10, 12:17 am, pauldepst...@att.net wrote:
Suppose
const int& i = 7;
const int& j = 7;
Is i==j true?
Is 7 == 7? Obviously.
My compiler says yes. On the other hand, as I understand it,
equality of references means that the addresses being
referenced are identical.
Where did you get that. A reference is just an alias for an
object. Once it is initialized, it behaves exactly as if it
were the aliased object.
Hence, as I understand it, it is quite possible that the
integer 7 is being represented at two different addresses, and
that two different addresses contain a representation of 7 and
so i==j may be false. Is this correct?
No.
I'm not clear on the issue of equality of references.
It sounds like you're not clear on the issue of references in
general. Within an expression (any expression), references, as
such, don't exist---a reference is just an lvalue expression
referring to the object used to initialize it.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34