Skip to content

Commit 6518005

Browse files
committed
C++: Clean up the test for floating point loop counters.
1 parent f2c541f commit 6518005

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
| test.cpp:5:14:5:14 | f | Floating point variables should not be used as loop counters. |
22
| test.cpp:10:15:10:15 | d | Floating point variables should not be used as loop counters. |
33
| test.cpp:15:15:15:16 | ld | Floating point variables should not be used as loop counters. |
4-
| test.cpp:42:13:42:13 | r | Floating point variables should not be used as loop counters. |
4+
| test.cpp:36:13:36:13 | r | Floating point variables should not be used as loop counters. |

‎cpp/ql/test/query-tests/jsf/4.24 Control Flow Structures/AV Rule 197/test.cpp‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void test()
1818
use(ld);
1919
}
2020

21-
for (double c = 0.0; c < 1.0; c += 0.1) // BAD [NOT DETECTED]: compound assignment updates are not recognized
21+
for (double c = 0.0; c < 1.0; c += 0.1) // $ MISSING: Alert (compound assignment updates are not recognized)
2222
{
2323
use(c);
2424
}
@@ -27,12 +27,6 @@ void test()
2727
{
2828
use(i * 0.1);
2929
}
30-
31-
double x = 0.0; // GOOD: not a `for` loop counter
32-
while (x < 1.0)
33-
{
34-
x = x + 0.1;
35-
}
3630
}
3731

3832
typedef float real;

0 commit comments

Comments
 (0)