...
Code Block | ||
---|---|---|
| ||
if (a == b); { /* ... */ } |
The statements in the apparent body of the if
condition are always evaluated irrespective of the result of the condition expression.
Compliant Solution
It is likely, in this example, that the semicolon was accidentally insertedThis compliant solution eliminates the semicolon and ensures that the body of the if
construct is executed only when the condition expression is true.
Code Block | ||
---|---|---|
| ||
if (a == b) { /* ... */ } |
...