[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Arithmetic assignment side-effects

**From**: |
DJ Mills |

**Subject**: |
Re: Arithmetic assignment side-effects |

**Date**: |
Mon, 5 Aug 2013 22:57:20 -0400 |

On Sun, Aug 4, 2013 at 4:41 PM, Andreas Schwab <address@hidden>wrote:
>* Chris Down <address@hidden> writes:*
>
>* x+=a is the same as x=x+a. Now replace a by (x=1) and it becomes*
>* obvious that 1 is a perfectly valid outcome.*
>
>
I still don't see that; for one thing even with:
#include <stdio.h>
int main(void) {
int x = 0;
printf("%d\n", x = x + (x = 1));
return 0;
}
I'm still seeing "assign x = 1, then do x + x, then assign the result to
x", which would give 2. gcc agrees with me. Especially with the parens
there, that's the order I would expect, but it's the same without as well.

**Re: [ast-users] Arithmetic assignment side-effects**, *(continued)*
**RE: [ast-users] Arithmetic assignment side-effects**, *Janis Papanagnou*, `2013/08/03`
**Re: Arithmetic assignment side-effects**, *Chris Down*, `2013/08/04`
**Re: Arithmetic assignment side-effects**, *Andreas Schwab*, `2013/08/04`
**Re: Arithmetic assignment side-effects**, *Chris Down*, `2013/08/04`
**Re: Arithmetic assignment side-effects**, *Linda Walsh*, `2013/08/04`
**Re: Arithmetic assignment side-effects**, *Dan Douglas*, `2013/08/05`
**Re: Arithmetic assignment side-effects**, *Linda Walsh*, `2013/08/05`
**Re: Arithmetic assignment side-effects**, *Andreas Schwab*, `2013/08/05`
**Re: Arithmetic assignment side-effects**, *DJ Mills*, `2013/08/05`
**Re: Arithmetic assignment side-effects**,
*DJ Mills* **<=**
**Re: Arithmetic assignment side-effects**, *Andreas Schwab*, `2013/08/06`
**Re: Arithmetic assignment side-effects**, *Dan Douglas*, `2013/08/06`
**Re: Arithmetic assignment side-effects**, *Andreas Schwab*, `2013/08/06`
**RE: [ast-users] Arithmetic assignment side-effects**, *Janis Papanagnou*, `2013/08/06`
**Re: [ast-users] Arithmetic assignment side-effects**, *Chet Ramey*, `2013/08/06`
**Re: [ast-users] Arithmetic assignment side-effects**, *Chet Ramey*, `2013/08/06`
**Re: Arithmetic assignment side-effects**, *DJ Mills*, `2013/08/06`
**Re: Arithmetic assignment side-effects**, *Chet Ramey*, `2013/08/06`