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

Georg Wrede georg.wrede at
Sat May 16 19:32:21 PDT 2009

Andrei Alexandrescu wrote:
> Christopher Wright wrote:
>> Georg Wrede wrote:
>>> bearophile wrote:
>>>> Georg Wrede:
>>>>> 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.
>>>> I agree that putting such things in code is bad, but nowadays the
>>>> solution adopted by C is Just Wrong. To help avoid bugs from your
>>>> programs the language has to avoid undefined behaviors (this is one of
>>>> the lessons of Java).
>>> If Walter had ulimited time, the of course I'd favor either defining 
>>> the precedence, or then enforcing errors on them, and not leaving 
>>> them undefined. 
>> $ su walter
>> $ ulimit -t unlimited
> I swear I wanted to post this too! :o)

Nice quips, from you both...    :-)

But there's a bug in the algorithm. A more correct version would be:

$ su
$ ulimit -t unlimited
$ su walter

More information about the Digitalmars-d mailing list