[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arithmetic expression: evaluation order bug

From: Greg Wooledge
Subject: Re: Arithmetic expression: evaluation order bug
Date: Thu, 29 Dec 2022 18:45:48 -0500

On Fri, Dec 30, 2022 at 12:21:52AM +0100, Steffen Nurpmeso wrote:
> ..i want to reiterate the relation to what "human logic" expects.

I'm a human, so I feel qualified to address this point.

What I expect from a command like

(( i += j += i += j ))

is to get unpredictable results that have no relationship to anything
useful, because that code is complete rubbish.

I can't even guess what the *intent* of the code is.

I'm not optimistic enough to expect an error message, or even better,
an immediate termination of the shell.  That would be *far* too useful
(because it would force the script's author to rewrite that code).

reply via email to

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