On Fri, Oct 12, 2007 at 10:45:14AM -0400, Clint Adams wrote:
> On Mon, Oct 08, 2007 at 08:35:42AM +0800, Herbert Xu wrote:
> > Yes.
> 
> Based on the contents of tests/arith.t, I'm wondering if this is somehow
> intentional.

I've tested every other shell and they all disagree with posh,
except pdksh :)

$ bash -c 'echo $((0 ? x=3 : 4)); echo $x'
4

$ ksh93 -c 'echo $((0 ? x=3 : 4)); echo $x'
4

$

In any case, behaving differently depending on a pair of brackets
is strange:

$ posh -c 'echo $((0 ? x=3 : 4)); echo $x'
4
3
$ posh -c 'echo $((0 ? (x=3) : 4)); echo $x'
4

$

Either it should assign in both cases or neither.

As far as POSIX is concerned, it defers to ISO C on this.  The
semantics in ISO C is quite clear, that is, the assignment should
not occur.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to