Order of evaluation - aka hidden undefined behaviours.

Timon Gehr timon.gehr at gmx.ch
Thu Sep 27 05:13:06 PDT 2012


On 09/27/2012 12:38 PM, Walter Bright wrote:
> On 9/26/2012 5:04 AM, Timon Gehr wrote:
>> Why should the calling convention have an impact on code
>> semantics?
>
> Maximizing performance.
>

Optimisations by definition do not have an impact on code semantics.

>> The code reads LTR, therefore evaluation should consistently be LTR.
>
> The best order is the one that generates the fewest temporaries, and
> that's the order that should be defined for D.

The number of temporaries is not affected by the order of
evaluation. Just push the arguments on the stack out-of-order.
Furthermore, the 'natural' order of C argument evaluation differs
between architectures, making the entire point moot.


More information about the Digitalmars-d mailing list