It's been a while since I start programming in C, however, I still feel confused about unsigned
. If we compiled this code:
#include <stdio.h>
int main(int argc, char **argv)
{
unsigned int x = -1;
return 0;
}
both gcc and VC++ don't raise any error or even a warning regarding using negative number with unsigned
.
My question is that does unsigned
do any internal job or it just a hint to the programer that this value shouldn't be negative?
/W4
, I'm sure GCC does too. – DCoder Sep 2 '12 at 16:23