cppcheck 2.20.0 generates AssignmentIntegerToAddress for the following code:
#include <windows.h> int main() { int first_id = 1; int res = 5; const char* ptr = MAKEINTRESOURCE(res - first_id); (void)ptr; return 0; }
cppcheck.exe --enable=all --library=windows .
test\main.cpp:7:18: portability: Assigning an integer to a pointer is not portable. [AssignmentIntegerToAddress] const char* ptr = MAKEINTRESOURCE(res - first_id); ^
MAKEINTRESOURCE:
#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
cppcheck doesn't take casting into account.
Thanks for reporting, see https://trac.cppcheck.net/ticket/14564
Log in to post a comment.
cppcheck 2.20.0 generates AssignmentIntegerToAddress for the following code:
MAKEINTRESOURCE:
cppcheck doesn't take casting into account.
Last edit: Nikita Leontiev 3 days ago
Thanks for reporting, see https://trac.cppcheck.net/ticket/14564