Pointers vs. References

Regan Heath regan at netmail.co.nz
Thu Jun 14 05:46:58 PDT 2007


Oskar Linde Wrote:
> Myron Alexander skrev:
> > Bill Baxter wrote:
> >> But '==' *does* work differently for different types.  Already.
> > 
> > Sorry. What I meant is that is has the same semantics. When you see ==, 
> > you can be sure that it means "check if value is the same".
> 
> One could argue that = should be analogous to ==. I.e, if = assigns 
> references, == should compare references.
> 
> I am not arguing either way. :)

One could also argue that the value of a class reference is the memory address of the class to which it refers, as is the case with pointers.

struct A{}
A* p;
A* s;

if (s == p) //compares address pointer 'points' at

Regan



More information about the Digitalmars-d mailing list