[Top][All Lists]

[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 16:48:15 +0100
User-agent: s-nail v14.9.24-383-g2889cb06b9

Robert Elz wrote in
 |The way to make this work is to insert sequence points, of which there
 |is only one which is plausible in shell arithmetic expressions, and even
 |that isn't required to exist by POSIX.
 |   $(( i += i, j += i, i += j ))
 |for that expression (and similar for the other one) is defined in C, and
 |so should be implemented the same way by all shells, and is, at least by
 |those which actually implement the ',' operator (which excludes dash,
 |the FreeBSD sh, and yash).   Affected people might want to apply some
 |pressure to the implementors of those to add the required support, it is
 |trivial to do (just multiple expressions, evaluated one after another).
 |For what it is worth, I tested a bunch of shells with the original
 |expressions, all ksh variants, bosh, and bash evaluate the original
 |expressions the bash way, all ash variants, plus yash and zsh implement
 |it the dash way.   Neither is incorrect.

Thanks -- i should have done that, and if only out of interest
(but have only three shells here).  Yes, comma is not always
supported.  Of course i continue to disagree as i continue to
disagree on much of the sequence point outcome of ISO C, too.
(Granted that many cultures do it right-to-left or top-to-bottom
instead.  And i like his dove RFC, that was he, i think.  Those
doves are heroes!  Yes, one day there was noise on my working room
window, but i sent him away, but of all windows it was mine in
particular, he tried and tried, did not want to be helped in when
i finally opened, pointed me to the ring on the leg, so
i contacted the owner, still 200 kilometres away, disappointed,
strong wind it was, shit was green, totally exhausted, (very!)
good food for two days, then brought him to the president of the
local dove club so he could have look (i was not loved for this
needless decision), and i was later called back as he got home
after doing the remaining 30 percent, and i cheered through the
telephone which was all i could do; 'flew by to say hello many
months later, or a year, "this time i make it!" (very same
journey!), .. and some years later even went through the room,
which i found unbelievable.  A real and unforgotten character.)


(P.S.: leaving doves where they belong.)

|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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]