Hi, apologies for the late reply. Here is a minimal example which reproduces the problem: static void wait(const HAL* hal, const uint32_t time_out) { uint32_t start_time = hal->get_time_ms(); uint32_t elapsed = 0; while (elapsed <= time_out) { // Update elapsed time. elapsed = hal->get_time_ms() - start_time; } }
Hi, I have the following loop which gives me a [duplicateExpression] and a [unsignedPositive] false positives, which I think are related: const uint32_t time_out = some_value; uint32_t start_time = get_time_ms(); uint32_t elapsed = 0; while (elapsed <= time_out) { do_something_until_timeout(); // Update elapsed time. elapsed = get_time_ms() - start_time; } I think it is because cppcheck doesn't know that get_time_ms() returns a different value everytime. Is there a way to fix this or should I ignore...