cppcheck cannot divine the programmer's intentions. The if was probably flagged because the same condition had already been checked in the while statement.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
G'Day
I had the following coded:
while ((a != NULL) && (b != NULL)) {
if (a!=NULL) {
a=a->next;
...and if flagged it as an incorrect inner if, indicating the if statement
was wrong.
while (a!=NULL)
if (a!=NULL)
The if statement was fine. The problem was that the while loop should have
had an || not an &&.
Mik
cppcheck cannot divine the programmer's intentions. The
if
was probably flagged because the same condition had already been checked in thewhile
statement.