NoNo for Associativity of Assignments?
Manfred Nowak
svv1999 at hotmail.com
Sun Feb 25 16:30:02 PST 2007
Joel C. Salomon wrote
> In C-like languages, assignment is right-associative; a = b = c
> /always/ is parsed as a = (b = c).
I have already posted what the specs for D say about evaluation order:
no right associativity for assignments is given.
When evaluating "a[ 1] = a[ 2] = ... = a[n]" the compiler is allowed to
choose any assignment "a[ i] = a [i+1]" for some valid i at random
order for evaluation.
The compiler is free to store those assignments in an AA and then loop
in a foreach over those assignments to execute them---or even
distribute them over several cores to be faster.
Of course DMD does not do such currently.
-manfred
More information about the Digitalmars-d
mailing list