anything like C++ references?

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Mon Jul 21 22:03:03 EDT 2003


On Tue, 15 Jul 2003 07:03:11 +0100, rumours say that Stephen Horne
<intentionally at blank.co.uk> might have written:

>You could make a very strong case for references being a distinct
>datatype from pointers

I think you were correct to say that references act as pointers *and*
syntactic sugar.  Simply put, a declaration of a reference:

int &c;

could be interpreted as:

int *__c;
#define c (*__c)

with a corresponding #undef at the end of the block.

This explains stuff like why one uses . instead of -> with a reference.
Anyway, this is how *I* interpreted C++ references once I met them, and
it kind of stuck in my mind.  I could be missing something, though...
I'm more of a plain-C person.
-- 
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.




More information about the Python-list mailing list