however, if the typedefs are not present and cppcheck doesn't know what STR is
void f() {
void *buf;
STR s = (STR) &buf;
}
iscast() in tokenlist.cpp returns false for (STR) and the & is parsed as a bitwise AND, instead of the address-of operator. Because the & is a binary operator on unitialized data, this example throws a false positive:
this sort of code is analyzed properly and throws no errors
however, if the typedefs are not present and cppcheck doesn't know what STR is
iscast() in tokenlist.cpp returns false for (STR) and the & is parsed as a bitwise AND, instead of the address-of operator. Because the & is a binary operator on unitialized data, this example throws a false positive:
examples/uninit.c:3:19: error: Uninitialized variable: buf [uninitvar]
STR s = (STR) &buf;