Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
305 - Potential mismatch between sizeof and countof quantities.
This warning indicates that a variable holding a sizeof result is being added to or subtracted from a countof expression.
This causes unexpected scaling in pointer arithmetic.
Example
Defective Source
struct S {int a; int b;} *p = some_array;
int cb = sizeof(struct S);
p += cb;
Corrected Source
struct S {int a; int b;} *p = some_array;
p += 1;
Send Feedback on this topic to the authors