...
The following controlling expression is noncompliant because &&
is not a comparison or relational operator and the entire expression is not primary:
Code Block | ||||
---|---|---|---|---|
| ||||
if ((v = w) && flag) { /* ... */ } |
When the assignment of v
to w
is not intended, the following controlling expression can be used to execute the conditional block when v
is equal to w
:
Code Block | ||||
---|---|---|---|---|
| ||||
if ((v == w) && flag) { /* ... */ }; |
When the assignment is intended, the following controlling expression can be used:
Code Block | ||||
---|---|---|---|---|
| ||||
if (((v = w) != 0) && flag) { /* ... */ }; |
...