anything like C++ references?
Erik Max Francis
max at alcyone.com
Wed Jul 16 15:37:16 EDT 2003
Moshe Zadka wrote:
> On Wed, 16 Jul 2003, Michael Chermside <mcherm at mcherm.com> wrote:
>
> > stuff[i] = newComplexObject(i++, "name", "fred")
>
> I'm not entirely sure that C code is not undefined. I think it
> is, but it could be that I'm mistaken and that "=" is a "sequence
> point".
> It's a variant on the old
>
> a[i]=i++
>
> thing. The problem here is that it's not certain what happens first --
> the a[i] (evalating to an lvalue) or i++.
Assignments are definitely not sequence points. But function calls are.
So the code is well-defined, and is equivalent to
<temporary> = newComplexObject(i++, "name", "fred");
stuff[i] = <temporary>;
(Presuming, of course, newComplexObject is a function call. If it were
implemented as a macro then that'd be something else.)
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Everybody's playing the game / But nobody's rules are the same
\__/ Florence, _Chess_
More information about the Python-list
mailing list