Compiler Warning (level 3) C4146

unary minus operator applied to unsigned type, result still unsigned

The variable should be cast to a signed type if it must contain a signed value. Its type is still unsigned.

The following example causes this warning:

void func()
{
   unsigned int ui;
   -ui;              // warning
}