[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:54:30 -0400 |
On Sun, Aug 4, 2013 at 9:08 PM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Chris Down wrote:
>
>> Yes, I agree, it becomes ambiguous when described in this fashion. I
>> think the
>> aesthetics of x+=y vs x=x+y are important here.
>>
>
> From the bash manpage, it would see that += is higher precedence
> than assignment, so the increment would be done first, followed
> by the attempt at an assignment of 1 to 1.
>
> (Which might be determined as 'true', = 1 in (()) expressions...
> so -- only in looking at the manpage, I'd have to lean toward '1'.
>
> (I had been leaning toward 2 since the ='s are evaled from the right, but
> the += is done first according to this:
>
>
>
> The operators and their precedence, associativity, and values are the
> same as in the C language. The following list of operators is
> grouped
> into levels of equal-precedence operators. The levels are
> listed in
> order of decreasing precedence.
>
> id++ id--
> variable post-increment and post-decrement
> ++id --id
> variable pre-increment and pre-decrement
> - + unary minus and plus
> ! ~ logical and bitwise negation
> ** exponentiation
> * / % multiplication, division, remainder
> + - addition, subtraction
> << >> left and right bitwise shifts
> <= >= < >
> comparison
> == != equality and inequality
> & bitwise AND
> ^ bitwise exclusive OR
> | bitwise OR
> && logical AND
> || logical OR
> expr?expr:expr
> conditional operator
> = *= /= %= += -= <<= >>= &= ^= |=
> assignment
> expr1 , expr2
> comma
>
>
Where do you see that? They're all equal in precedence:
"The following list of operators is grouped into levels of equal-precedence
operators."
= *= /= %= += -= <<= >>= &= ^= |=
assignment
- 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 <=
- Re: Arithmetic assignment side-effects, DJ Mills, 2013/08/05
- 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