Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if-statement with two checks with different data types
#3
Is that really correct? If "int" on the particular system is 16 bits, then

a will be integer promoted to type int.
3 is of type int.
(a > 3) will be of type int.

b will remain unsigned int
5u will remain unsigned int
(b > 5u) will be of type unsigned int

(a > 3) && (b > 5u), the usual arithmetic conversions take place, converting the left-side expression to unsigned int.
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)