Here's some sample C code tested on a 32-bit Linux system:
int main(int argc, char *argv)
unsigned int val1 = 0xffffffff;
printf("val1 == -1: %d\n", val1 == -1);
val1 == -1: 1
Any decent compiler should warn that such a check is always false, but people don't always pay attention to that stuff....