==> claim <== style: Return value '++energy_!=0' is always true [knownConditionTrueFalse]
bool Racer::rest() { return ++energy_ != 0; }
==> rebuttal <== Incrementing the maximum size_t always wraps around to 0.
#include <iostream> #include <cstddef> #include <limits> int main() { size_t x = std::numeric_limits<size_t>::max(); x++; std::cout << x << "\n"; // prints 0 }
This is tracked here: https://trac.cppcheck.net/ticket/10616
Log in to post a comment.
==> claim <==
style: Return value '++energy_!=0' is always true [knownConditionTrueFalse]
==> rebuttal <==
Incrementing the maximum size_t always wraps around to 0.
This is tracked here: https://trac.cppcheck.net/ticket/10616