[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arithmetic expression: evaluation order bug
From: 
Steffen Nurpmeso 
Subject: 
Re: Arithmetic expression: evaluation order bug 
Date: 
Fri, 30 Dec 2022 00:21:52 +0100 
Useragent: 
snail v14.9.24383g2889cb06b9 
And, lastly (from my side)..
Steffen Nurpmeso wrote in
<20221229231538.Pz4j9%steffen@sdaoden.eu>:
...
Alain D D Williams wrote in
 <20221229215700.GD16276@phcomp.co.uk>:
 ...
Anyway: back to what the shell should be doing. You cannot put a ';' \
into (( ))
as a sequence point, but the manual does say:

"Subexpressions in parentheses are evaluated first and may override the
precedence rules above"

So use subexpressions to 'evaluate first' so you should prolly rewrite:
...
(( i += (j += (i += i)) ))

I had tried that with clang (and now with gcc Wall).
..i want to reiterate the relation to what "human logic" expects.
Now, the entire scene is often on the brainfuck (programming
language) side, nonetheless i, and the way all tested ISO
C compilers, and dash, and my evaluator do it, would hope in the
sense of "what comes natural"ly, that my point of view counts as
what "human logic" would expect.
Ciao,
steffen

Der Kragenbaer, The moon bear,
der holt sich munter he cheerfully and one by one
einen nach dem anderen runter wa.ks himself off
(By Robert Gernhardt)
 Re: Arithmetic expression: evaluation order bug, (continued)
 Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Andreas Schwab, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Andreas Schwab, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Andreas Schwab, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
 Re: Arithmetic expression: evaluation order bug,
Steffen Nurpmeso <=
 Re: Arithmetic expression: evaluation order bug, Greg Wooledge, 2022/12/29
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/30
 Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/30
 Re: Arithmetic expression: evaluation order bug, Robert Elz, 2022/12/30
 Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/30
 Re: Arithmetic expression: evaluation order bug, Robert Elz, 2022/12/30