Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: changed color of EX1 NCCE

...

The following controlling expression is noncompliant because && is not a comparison or relational operator and the entire expression is not primary:

 

Code Block
bgColor#ccccff#FFcccc
langc
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
bgColor#ccccff
langc
if ((v == w) && flag) { /* ... */ }; 

When the assignment is intended, the following controlling expression can be used:
 

Code Block
bgColor#ccccff
langc
if (((v = w) != 0) && flag) { /* ... */ }; 

...