mirror of
https://github.com/github/codeql.git
synced 2026-05-07 22:51:41 +02:00
16 lines
283 B
C++
16 lines
283 B
C++
int f() {
|
|
int i;
|
|
int total = 0;
|
|
|
|
for (i = 0; i < 10; i = i+1) { // GOOD: comparison could be either true or false.
|
|
total += i;
|
|
}
|
|
|
|
for (i = 0; i < 10; i = i+1) { // BAD: comparison is always true, because i <= 5.
|
|
i = i % 5;
|
|
total += i;
|
|
}
|
|
|
|
return total;
|
|
}
|