From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29619 invoked from network); 19 Jun 2008 17:14:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Jun 2008 17:14:24 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33004 invoked from network); 19 Jun 2008 17:14:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Jun 2008 17:14:18 -0000 Received: (qmail 3771 invoked by alias); 19 Jun 2008 17:14:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25221 Received: (qmail 3759 invoked from network); 19 Jun 2008 17:14:15 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Jun 2008 17:14:15 -0000 Received: from prunille.vinc17.org (vinc17.pck.nerim.net [213.41.242.187]) by bifrost.dotsrc.org (Postfix) with ESMTP id 8E12E8084FA0 for ; Thu, 19 Jun 2008 19:14:12 +0200 (CEST) Received: by prunille.vinc17.org (Postfix, from userid 501) id 2ED462368E23; Thu, 19 Jun 2008 19:14:12 +0200 (CEST) Date: Thu, 19 Jun 2008 19:14:11 +0200 From: Vincent Lefevre To: zsh-workers@sunsite.dk Cc: "Jun T." Subject: Re: arithmetic operator precedence Message-ID: <20080619171411.GM10734@prunille.vinc17.org> Mail-Followup-To: zsh-workers@sunsite.dk, "Jun T." References: <20080617094509.GC5016@sc.homeunix.net> <2d460de70806170324o5a44609x9383cc2445d67dd6@mail.gmail.com> <20080617103829.GD5016@sc.homeunix.net> <20080617114340.398c731f@news01> <20080617112815.GF10734@prunille.vinc17.org> <200806171146.m5HBkhfR013230@news01.csr.com> <20080619095454.GE5016@sc.homeunix.net> <20080619160024.GK10734@prunille.vinc17.org> <20080619162036.GF5016@sc.homeunix.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080619162036.GF5016@sc.homeunix.net> X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.18-vl-r22984 (2008-06-11) X-Virus-Scanned: ClamAV 0.92.1/7506/Thu Jun 19 16:51:14 2008 on bifrost X-Virus-Status: Clean 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 y )) > > in a POSIX script, because the result is unspecified. > > z=$(($x $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 - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)