Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: arithmetic operator precedence
- X-seq: zsh-workers 25221
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: arithmetic operator precedence
- Date: Thu, 19 Jun 2008 19:14:11 +0200
- Cc: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- In-reply-to: <20080619162036.GF5016@xxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-workers@xxxxxxxxxx, "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080617094509.GC5016@xxxxxxxxxxxxxxx> <2d460de70806170324o5a44609x9383cc2445d67dd6@xxxxxxxxxxxxxx> <20080617103829.GD5016@xxxxxxxxxxxxxxx> <20080617114340.398c731f@news01> <20080617112815.GF10734@xxxxxxxxxxxxxxxxxxx> <200806171146.m5HBkhfR013230@xxxxxxxxxxxxxx> <a0600102dc47fd2c6184e@xxxxxxxxxxxxxxxxx> <20080619095454.GE5016@xxxxxxxxxxxxxxx> <20080619160024.GK10734@xxxxxxxxxxxxxxxxxxx> <20080619162036.GF5016@xxxxxxxxxxxxxxx>
On 2008-06-19 17:20:36 +0100, Stephane Chazelas wrote:
> I'm under the impression your misunderstand the purpose of
> POSIX. POSIX is a tool to help people write portable
> applications (when it comes to shells, that means _scripts_).
>
> You cannot write z=$(( x <op> y ))
>
> in a POSIX script, because the result is unspecified.
>
> z=$(($x <op> $y))
>
> is specified (with the conditions I detailed).
>
> If in your script, you make sure $x and $y are integer constants
> (as in [-+]?(0[xX][a-fA-F0-9]+|0[0-7]+|[1-9][0-9]*)), then it
> will work as expected.
I think it is useless to continue the discussion with someone that
hasn't read what POSIX says.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author