On Thu, Dec 29, 2022 at 05:35:48PM +0000, Alain D D Williams wrote: > On Thu, Dec 29, 2022 at 06:23:09PM +0100, Steffen Nurpmeso wrote: > > Hello. > > > > Name: bash > > Path: /usr/ports/core > > Version: 5.2.15 > > Release: 1 > > > > $ i=10 j=20;echo $(( i += j += i += j ));echo $i,$j > > 60 > > 60,50 > > $ i=10 j=20;echo $(( i += j += i += i ));echo $i,$j > > 50 > > 50,40 > > You are modifying something that is used elsewhere in an expression. I am not > surprised that you do not get what you expect; others might expect something > different.
I don't think that is correct. Unlike a++ - --a which is unspecified in C because the order of evaluation of the lhs and rhs of the - operator is unspecified, the order of evaluation of i += j += i += i or i += (j += (i += i)) is well defined and in no way ambiguous. emanuele6