standards/52972: /bin/sh arithmetic not POSIX compliant

Wartan Hachaturow wart at tepkom.ru
Mon Jun 23 03:10:23 PDT 2003


The following reply was made to PR standards/52972; it has been noted by GNATS.

From: Wartan Hachaturow <wart at tepkom.ru>
To: Dag-Erling Sm?rgrav <des at des.no>
Cc: freebsd-gnats-submit at freebsd.org
Subject: Re: standards/52972: /bin/sh arithmetic not POSIX compliant
Date: Mon, 23 Jun 2003 14:06:19 +0400

 On Mon, Jun 23, 2003 at 08:32:55AM +0200, Dag-Erling Sm?rgrav wrote:
 
 > Yes, it should be left as-is so the part of the code that evaluates
 > arithmetic expressions knows what variable is involved.  For instance,
 > "$(($a+=1)) would expand to "$((1+=1))" before evaluation, which makes
 > no sense, while "$((a+=1))" clearly says to increase a with 1.
 
 Yes, the latter was the thing that I couldn't understand -- how may one
 implement +=, if variables are not required in arithmetic evaluation.
 But now, I've noticed the line I've missed while reading SUS:
 
 "Arithmetic Precision and Operations
 Integer variables and constants, including the values of operands and
 option-arguments, used by the standard utilities listed in this volume
 of IEEE Std 1003.1-2001 shall be implemented" 
 
 Question is closed :)
 
 -- 
 Regards, Wartan.


More information about the freebsd-standards mailing list