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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 11 06:27:35 PDT 2009


Georg Wrede wrote:
> 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.

By not stating it, I introduce a gratuitous nonportability.

Andrei



More information about the Digitalmars-d mailing list