Re: value of the constant expression 1<<(1?1:1) < 0x9999
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 29 Apr 2008 16:36:20 -0700
Peter Nilsson <airia@xxxxxxxxxxx> writes:
Keith Thompson wrote:
...
I'll assume that types int and unsigned int are 16 bits.
1<<(1?1:1) has the value 2 and is of type int.
0x9999 has the value 39321 and is of type unsigned int.
The "usual arithmetic conversions" are applied to the operands
of "<". This converts the left operand, 2, from int to unsigned int.
So the expression 1<<(1?1:1) < 0x9999 is equivalent to
1U < 39321U,
ITYM: 2U < 39321U
Yes, thanks.
--
Keith Thompson (The_Other_Keith) <kst-u@xxxxxxx>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- References:
- value of the constant expression 1<<(1?1:1) < 0x9999
- From: Francois Grieu
- Re: value of the constant expression 1<<(1?1:1) < 0x9999
- From: Keith Thompson
- Re: value of the constant expression 1<<(1?1:1) < 0x9999
- From: Peter Nilsson
- value of the constant expression 1<<(1?1:1) < 0x9999
- Prev by Date: Re: sorting the input
- Next by Date: Re: Integer to string conversion
- Previous by thread: Re: value of the constant expression 1<<(1?1:1) < 0x9999
- Next by thread: Re: value of the constant expression 1<<(1?1:1) < 0x9999
- Index(es):
Relevant Pages
|