On 04/01/2014 08:40 PM, Sarath Kodali wrote:
...

The evaluation order of assign operators should not be LTR as they have
right associativity. In "a = b = c", c has to be evaluated first, then b
and then a. Similarly, in "a = b + c", "b+c" has to be evaluated first
before a is evaluated. Otherwise it will be very confusing, that in some
cases it is LTR and in some it is RTL.

Note that this is after a paragraph that suggests to make evaluation in some cases LTR and in some RTL.

Other binary operators like "+" have left associativity, and hence
evaluation for these should be LTR as mentioned in D spec.
...

What's the presumed relation between associativity and evaluation order?

In particular, the ternary operator ?: is right associative. How on earth are you going to evaluate it right to left?

The C spec requires that the function arguments are to be pushed in RTL
order.

[citation needed]

The DMD codegen uses pushl x86 instructions for pushing args. If the
frontend changes the func args evaluation order to LTR, then the backend
has to be modified  to use mov x86 instructions as is done by gcc codegen.

- Sarath


The backend does not necessarily have to be modified to achieve this.

Reply via email to