unreadVariable doesn't appear on slightly modified code:
void func()
{
bool flag = false;
for (uint8_t i = 0; i < 10; ++i)
{
if (i % 2 == 0)
{
if (i < 5)
flag = true;
}
else
flag = false;
if (flag)
printf("\n");
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
cppcheck 2.18.0 generates unreadVariable false positive for the following code:
unreadVariable doesn't appear on slightly modified code:
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14192