다음을 통해 공유


PREfast Warning 305 (Windows CE 5.0)

Send Feedback

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

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.