bug-bash
[Top][All Lists]
Advanced

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

Re: [ast-users] Arithmetic assignment side-effects


From: Roland Mainz
Subject: Re: [ast-users] Arithmetic assignment side-effects
Date: Sun, 4 Aug 2013 00:52:40 +0200

On Sun, Aug 4, 2013 at 12:41 AM, Dan Douglas <ormaaj@gmail.com> wrote:
> On Sunday, August 04, 2013 12:30:48 AM Roland Mainz wrote:
>> On Sun, Aug 4, 2013 at 12:04 AM, Dan Douglas <ormaaj@gmail.com> wrote:
>> > Is it specified what the value of x should be after this expression?
>> >
>> > x=0; : $((x+=x=1))
>> >
>> > Bash, ksh93, mksh, posh say 1. zsh, dash, busybox say 2. Clang and gcc
>> > both throw warnings about it, but both plus icc agree on 2.
>>
>> Just curious: Is that x86-specific or is the result always the same on
>> other architectures, too ? Maybe there is something in ISO C1X/C99
>> which actually defines or recommends a specific compiler behaviour.
>> Maybe we should ask the "clang" people about the "why ?" ...
>
> I've only tested x86 but my hunch would be it either requires/suggests 2, or
> leaves it unspecified.

I'm not sure... but I am away from home and can't check my library for now...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)



reply via email to

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