On Fri, Dec 30, 2022 at 12:15:38AM +0100, Steffen Nurpmeso wrote: > Ah, wait.. > > Alain D D Williams wrote in > <20221229215700.gd16...@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: > | > |"Sub-expressions in parentheses are evaluated first and may override the > |precedence rules above" > | > |So use sub-expressions to 'evaluate first' so you should prolly rewrite: > | > |(( i += j += i += i )) > | > |as: > | > |(( i += (j += (i += i)) )) > > I had tried that with clang (and now with gcc -Wall).
My quote from "the manual" is the bash manual (version 5.0.3 on Debian 10 (Buster)) so the 'evaluate first' applies to bash not the C language. Please understand that different languages might do things differently. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 https://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: https://www.phcomp.co.uk/Contact.html #include <std_disclaimer.h>