On Mon, Aug 5, 2013 at 9:01 AM, Anders Johansson <[email protected]> wrote:
> On 08/04/2013 12:41 AM, Dan Douglas wrote:
>> On Sunday, August 04, 2013 12:30:48 AM Roland Mainz wrote:
>>> On Sun, Aug 4, 2013 at 12:04 AM, Dan Douglas <[email protected]> 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.
>
> It is expressly forbidden by C99 (6.5.2:
>
>
>>> Between the previous and next sequence point an object shall have its 
>>> stored value modified at most once by the evaluation of an expression. 
>>> Furthermore, the prior value shall be read only to determine the value to 
>>> be stored.
>
> As such, the expression in question here (x+=x=1) is undefined

Thanks for the answer... :-)

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to