K
karthikbalaguru
Hi,
I have a query w.r.t order of precedence.
Lemme start from the below list. (I have not considerred the () []
-> . sizeof etc that come above the below list)
* / % - Left to Right
+ - - Left to Right
<< >> - Left to Right
< <= > >= - Left to Right
== != - Left to Right
& - Left to Right
^ - Left to Right
| - Left to Right
&& - Left to Right
|| - Left to Right
?: - Left to Right
= += -= *= /= %= &= ^= |= <<= >>= - Right to Left
But, here is my query w.r.t the last line in the above list
in comparison with the earlier lines .
Why does the >>= has higher priority compared to <<=,
while << has higher priority compared to >> ?
Why does |= has higher priority compared to ^= , while
^ has higher priority compared to | ?
I find the below order of precedence
&= > %= > /= > *=
while,
* > / > % > &
Further, i also find that
-= > +=
while,
+ > -
Why does the precedence/priority get changed/reversed
when combined with '=' ?
Any ideas ?
Thx in advans,
Karthik Balaguru
I have a query w.r.t order of precedence.
Lemme start from the below list. (I have not considerred the () []
-> . sizeof etc that come above the below list)
* / % - Left to Right
+ - - Left to Right
<< >> - Left to Right
< <= > >= - Left to Right
== != - Left to Right
& - Left to Right
^ - Left to Right
| - Left to Right
&& - Left to Right
|| - Left to Right
?: - Left to Right
= += -= *= /= %= &= ^= |= <<= >>= - Right to Left
But, here is my query w.r.t the last line in the above list
in comparison with the earlier lines .
Why does the >>= has higher priority compared to <<=,
while << has higher priority compared to >> ?
Why does |= has higher priority compared to ^= , while
^ has higher priority compared to | ?
I find the below order of precedence
&= > %= > /= > *=
while,
* > / > % > &
Further, i also find that
-= > +=
while,
+ > -
Why does the precedence/priority get changed/reversed
when combined with '=' ?
Any ideas ?
Thx in advans,
Karthik Balaguru