...
Code Block |
---|
|
if (a == b) {
do_x();
}
if (a == c) {
do_w();
}
|
Noncompliant Code Example (Unconditional Jump)
Unconditional jump statements typically has no effect.
Code Block |
---|
|
#include <stdio.h>
for (int i = 0; i < 10; ++i) {
printf("i is %d", i);
continue; // this is meaningless; the loop would continue anyway
}
|
Compliant Solution (Unconditional Jump)
The continue statement has been removed from this compliant solution.
Code Block |
---|
|
#include <stdio.h>
for (int i = 0; i < 10; ++i) {
printf("i is %d", i);
}
|
Risk Assessment
The presence of code that has no effect can indicate logic errors that may result in unexpected behavior and vulnerabilities.
...