The following code with a function pointer returning a bool reports a false positive on cppcheck 2.12.1:
static bool (*ptr)(void); void f() { if (ptr == NULL || !ptr()) { printf("Not true\n"); } }
test/test.c:5:25: style: Pointer expression 'ptr' converted to bool is always true. [knownPointerToBool] if (ptr == NULL || !ptr()) { ^
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12170
Log in to post a comment.
The following code with a function pointer returning a bool reports a false positive on cppcheck 2.12.1:
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12170