3 ms·
No, the compiler is proving that the return true statement must be executed given the axiom that the loop cannot overflow. This is tricky, because the code is
by gpderetta 3y ago
No, the compiler is proving that the return true statement must be executed given the axiom that the loop cannot overflow.
This is tricky, because the code is perfectly valid if it always early-exit (and I have written code like this myself that avoids bound checking by guaranteeing an early exit, when micro-optimizing), so it is hard to statically reject it. On the other hand it seems a very obvious thing to warn on.