Possible Duplicate:
unsigned int and signed char comparison
int j = 10;
unsigned int i = 10;
if( j > -1 )
    printf("1\n");
else
    printf("2\n");
if( i > -1 )
    printf("3\n");
else
    printf("4\n");
The output is :
1
4
I've traced into the assembly and the comparation is similar:
cmp     dword ptr [ebp-10h],0FFFFFFFFh
...
cmp     dword ptr [ebp-14h],0FFFFFFFFh
But still don't understand why one is true and the other is false.
IMO the cpu have no idea whether dword ptr is signed or not.
So how does it work under the hood?
UPDATE
anyone can explain it in assembly level?
 
     
     
     
     
     
     
     
    