[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] Type promotion and shift operators
From: |
David A. Lyons |
Subject: |
Re: [avr-chat] Type promotion and shift operators |
Date: |
Wed, 2 Feb 2011 14:51:45 -0800 |
On Feb 2, 2011, at 1:28 PM, Rick Mann wrote:
> ... according to my K&R C book (which you seem to be saying is out of date),
> the smaller type is promoted to a larger type when the types on an operator
> are different. ...
C99 spec: <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>
Page 84
> Bitwise shift operators
> ...
> The integer promotions are performed on each of the operands. The type of the
> result is that of the promoted left operand.
> ...
And from page 43, "the integer promotions" means:
> If an int can represent all values of the original type, the value is
> converted to an int; otherwise, it is converted to an unsigned int. These are
> called the integer promotions. All other types are unchanged by the integer
> promotions.
Cheers,
--Dave
- [avr-chat] Type promotion and shift operators, Rick Mann, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Michael Hennebry, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Rick Mann, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Michael Hennebry, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Rick Mann, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Michael Hennebry, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators, Rick Mann, 2011/02/02
- Re: [avr-chat] Type promotion and shift operators,
David A. Lyons <=
- Re: [avr-chat] Type promotion and shift operators, Michael Hennebry, 2011/02/02