Version: 2.10
struct Bar { Bar *next; }; void func(const Bar *b1, Bar *b2) { if(b1 != b2) { Bar **bp = &b2; while(*bp && *bp != b1) { bp = &(*bp)->next; } } }
gives
test.c:10:19: style: Condition '*bp!=b1' is always true [knownConditionTrueFalse] while(*bp && *bp != b1) {
Maybe the error is with reading the expression. When splitting the inner most line to:
Bar *t = *bp; bp = &t->next;
it's ok.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11574
Log in to post a comment.
Version: 2.10
gives
Maybe the error is with reading the expression. When splitting the inner most line to:
it's ok.
Last edit: Tobias Mark 2023-02-21
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11574