...
However, since comparison binds tighter than assignment, the value of the comparison foo() != err
is stored in ret
. So if foo()
succeeds, ret
will always be set to 0, and the if-statement will execute if and only if foo()
fails, exactly opposite of what the programmer expects.
...
Code Block | ||
---|---|---|
| ||
if((ret = foo()) != err) { /* use ret */ } |
Exceptions
EXP00-EX1: Mathemtical Mathematical expressions that follow algebraic order do not require parentheses. For instance, in the expression:
...