I disagree. The C++ standard makes it clear that a pointer is a complete object. The C++ standard makes no such statement regarding a reference. The implementation of a reference is left to the compiler. One way of handling it is to do as you said. There are other ways.
Saying IS in big letters make no difference. Here's someone else doing the same thing with italics, and they have a different spin; they say that the reference
is the object.
http://www.parashift.com/c++-faq-lite/references.html#faq-8.1
Interestingly, their implementation does much the same as yours, but they don't find themselves compelled to insist that it's some kind of pointer. Perhaps because it's clearly not a pointer, as defined in the standard. Are you actually saying that it's not actually a bona fide pointer, but it behaves
like an "invisible pointer", whatever it means for a pointer to be invisible?
You are asserting as fact one possible means of meeting the standard. You are taking one compiler's interpretation and insisting that it is universal fact.
Pointer takes up memory. Reference does not have to take up memory; it is left to the implementation (very clearly stated in the standard). To assert that a reference is a pointer in the face of this seems nonsensical to me. Are we actually talking about the same thing?
While I'm here...
Seraphimsan wrote: |
---|
*cough reference pointers* |
The C++ standard nowhere contains this phrase. They do not exist in standard C++. I'd be very surprised if they existed in C. Again, I wonder if we're talking about the same thing. When I say "pointer" and "reference", I mean as defined in the C++ standard.