I have this sample code which generates the following warning (VS2008 compiler with SP1):
warning C4146: unary minus operator applied to unsigned type, result still unsigned
Code:
void f(int n)
{
}
int main()
{
unsigned int n1 = 9;
f(-n1);
}
But since function f
is taking it's parameter as an int
shouldn't this code compile without any warnings?