assignment: left-to-right or right-to-left evaluation?

Georg Wrede georg.wrede at iki.fi
Mon May 11 02:49:01 PDT 2009


Andrei Alexandrescu wrote:
> Consider:
> 
> uint fun();
> int gun();
> ...
> int[] a = new int[5];
> a[fun] = gun;
> 
> Which should be evaluated first, fun() or gun()? 

arra[i] = arrb[i++];

arra[i++] = arrb[i];

I'm not sure that such dependences are good code.

By stating a definite order between lvalue and rvalue, you would 
actually encourage this kind of code.



More information about the Digitalmars-d mailing list