Compiler Warning (level 1) C4319 (Windows CE 5.0)

Send Feedback

'operator' : zero extending 'type' to 'type' of greater size

The result of the ~ operator is unsigned and then converted to a larger type.

In the following example, ~(a - 1) is evaluated as a 32-bit unsigned long expression and then converted to 64 bits by zero extension. This leads to pointer truncations.

void* p;
unsigned long a;
typedef unsigned __int64 ULONG_PTR;

void main()
{
  p = (void*)((ULONG_PTR)p & ~(a - 1));
}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.