Order of evaluation - aka hidden undefined behaviours.

Iain Buclaw ibuclaw at ubuntu.com
Thu Sep 27 04:00:40 PDT 2012


On 27 September 2012 11:38, Walter Bright <newshound2 at digitalmars.com> wrote:
> On 9/26/2012 5:04 AM, Timon Gehr wrote:
>>
>> Why should the calling convention have an impact on code
>> semantics?
>
>
> Maximizing performance.
>
>
>> 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.

Can't see how you can get any fewer temporaries when following the
rule:  If it has side-effects, cache it's return value.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list