On 14 June 2013 12:04, bearophile <bearophileh...@lycos.com> wrote: > 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). >
Right... and the way to do that would be to evaluate the argument before calling the array op. eg: ref _tmp1 = b()[]; ref _tmp2 = c()[]; ref _tmp3 = a()[]; _tmp3 = _arrayOp(_tmp3, _tmp2, _tmp1); -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';