anything like C++ references?

Terry Reedy tjreedy at udel.edu
Thu Jul 17 13:15:03 EDT 2003


"Adam Ruth" <owski at hotmail.com> wrote in message
news:f0f51c80.0307150921.7b6667e2 at posting.google.com...
> register int x = 5;
> int *y = &x;
>
> This also cannot be done.  Why?  Different semantics for register
> variables.

Minor nit: 'register' is not a mandate, but an ignorable suggestion.
So a compiler either could or must ignore 'register' in able to make
'&x' possible.

Of course, the idea of ignorable keyword suggestion is itself somewhat
strange ;-)

> In some cases they act like variables, in others they act like
pointers.
>  Now that's confusing.

I was certainly confused for awhile.  About the time I finally got it,
I switched to Python.  I *initally* understood *all* Python bindings
to be like C++ references (which in terms of the CPython
implementation is +- true), but the very uniformity made 'reference'
less confusing to me.

Interesting comments.  I'm glad you piped in.

Terry J. Reedy






More information about the Python-list mailing list