More magical AA semantics

Jens Mueller jens.k.mueller at gmx.de
Fri Jan 11 02:16:05 PST 2013


deadalnix wrote:
> On Friday, 11 January 2013 at 08:55:55 UTC, Bernard Helyer wrote:
> >I completely agree. Doesn't the spec say that relying on
> >the order of assignment evaluation is undefined?
> 
> After a long discussion with Andrei, it seems that it is left to
> right.

Then the spec should be fixed.

unittest
{
	int a = 0;
	++a = a;
	assert(a == 1);
}

Don't know though whether you find it surprising that the above code
passes? But whether it is left to right or right to left does not matter
that much. At least it's defined and you can internalize it.
The more I think about the more sense it makes to have it left to right.

Jens


More information about the Digitalmars-d mailing list