Evaluation order of "+="

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 11 17:16:58 PDT 2016


On Monday, 11 July 2016 at 23:31:40 UTC, Danika wrote:
> On Monday, 11 July 2016 at 23:04:00 UTC, Johan Engelen wrote:
>> LDC recently changed the evaluation order of "+=" (I think 
>> unintentionally, some other eval order problems were fixed). 
>> Now, it is different from DMD.
>> I am going to argue that I think DMD's order is more useful in 
>> the context of fibers, and would like your opinion.
>
> I really think it is a bug, in C it prints 10. And following 
> the flow, you changed the sum to 9 and after that added 1, so 
> It would be 10.6

In C, it is UB.



More information about the Digitalmars-d mailing list