Σημείωμα
Η πρόσβαση σε αυτήν τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να εισέλθετε ή να αλλάξετε καταλόγους.
Η πρόσβαση σε αυτήν τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να αλλάξετε καταλόγους.
sizeof('integerConstant') always returns the size of the underlying integer type
Remarks
This warning indicates where an integral constant is used as a sizeof argument. Such expression always returns the size of the type of the constant. It's better to write sizeof(type) instead. This warning catches common typos in buffer offset calculations.
This check ignores character literals because buffer_size += sizeof(UNICODE_NULL) is a common idiom.
Example
The following example generates C6396:
void f()
{
int a = sizeof(5); // C6396 reported here
}
To fix this issue, replace the integral constant with its type:
void f()
{
int a = sizeof(int); // no C6396 reported here
}