다음을 통해 공유


PREfast Warning 334 (Windows CE 5.0)

Send Feedback

334 - The sizeof operator applied to an expression with an operator may yield unexpected results.

This warning indicates that PREfast has detected a misuse of the sizeof operator.

The sizeof operator, when applied to an expression, yields the size of the type of the resulting expression.

For example, in the following code:

     char                    a[10];
     size_t                  x;

     x = sizeof (a + 1);

x will be assigned the value 4, not 9, because the resulting is no longer a pointer to the array a, but simply a pointer.

Example

Defective Source

char    a[10];

return sizeof (a + 4);

Corrected Source

char    a[10];

return sizeof (a) - 4;

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.