Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 10.3, conversion of constant expression
#4
Actually, both operands are promoted to unsigned int, so on a 32bit processor you compare 0x000000FFh with 0xFFFFFFFFh, which is always false:

Code:
19:   switch (x)
0028140E  movzx       eax,byte ptr [_x (287138h)]  
00281415  mov         dword ptr [ebp-0C4h],eax  
0028141B  cmp         dword ptr [ebp-0C4h],0FFFFFFFFh  
00281422  je          foo+36h (281426h)  
00281424  jmp         foo+4Dh (28143Dh)

(C99 6.8.4.2 Item 5 and 6.3.8.1).
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)