C++: Remove arguable FPs re: sizeof/decltype

This commit is contained in:
Nora Dimitrijević
2022-09-28 20:01:14 +02:00
parent 592bc18a97
commit 6d5df14547
2 changed files with 18 additions and 1 deletions

View File

@@ -77,6 +77,10 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
j++);
(void)sizeof(x.foo(i++), // GOOD
j++);
using U = decltype(x.foo(i++), // GOOD? Unlikely to be misread
j++);
(void)sizeof(x.foo(i++), // GOOD? Unlikely to be misread
j++);
// Comma in loops
@@ -86,6 +90,11 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
i = j = i + j;
}
while (i = foo(j++), // GOOD??? Currently ignoring loop heads
i != j && i != 42 && !foo(j)) {
i = j = i + j;
}
for (i = 0, // GOOD? Currently ignoring loop heads.
j = 1;
i + j < 10;