The analyzer has detected a potential error: a macro expanding into a number serves as an argument for the 'sizeof' operator. Using the operator in such a way can cause allocation of memory amount of incorrect size or other defects.
Consider an example:
#define NPOINT 100
...
char *point = (char *)malloc(sizeof(NPOINT));
Executing this code will result in allocation of insufficient memory amount. This is the correct code:
#define NPOINT 100
...
char *point = (char *)malloc(NPOINT);
This diagnostic is classified as:
You can look at examples of errors detected by the V627 diagnostic. |
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders:
Take
a chance!