Expression evaluation order

bearophile bearophileHUGS at lycos.com
Fri Jun 14 04:04:03 PDT 2013


Iain Buclaw:

> However yes, the behaviour relies on the order the sucky X86 ABI
> pushes arguments onto the stack (which for this array op is 
> from right
> to left).  Whereas on *all* other architectures it will execute 
> the
> parameters in left to right order, which would be a, c, b in 
> this case.

D needs the same standard order of evaluations for all 
expressions on all compilers, regardless of the CPUs. The only 
other acceptable alternative is to statically forbid code that 
risks having variable results.

(And I think the right order for that is b, c, a).

Bye,
bearophile


More information about the Digitalmars-d mailing list