Re: Help me understand this compiler warning.
- From: "Morris Dovey" <mrdovey@xxxxxxxx>
- Date: Sun, 13 Aug 2006 08:10:42 -0500
pete (in 44DF1184.CAE@xxxxxxxxxxxxxx) said:
| The left operand is uc[7], which is of type unsigned char.
|
| Your posted code doesn't do anything to prevent
| type unsigned char from being promoted to type int.
|
| Why do you think that in
| (uc[7] >> 4)
| that the left operand won't be promoted to int?
|
| "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."
You're absolutely right. I'm not sure how I managed it; but I looked
it up, read it carefully, and concluded that the unsigned char would
be promoted to an unsigned int - very wrong.
Thanks for getting me on track - and to the OP, my apologies for an
incorrect response.
--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
.
- References:
- Help me understand this compiler warning.
- From: Charles Sullivan
- Re: Help me understand this compiler warning.
- From: Morris Dovey
- Re: Help me understand this compiler warning.
- From: pete
- Re: Help me understand this compiler warning.
- From: Morris Dovey
- Re: Help me understand this compiler warning.
- From: pete
- Help me understand this compiler warning.
- Prev by Date: Re: Newbie - itoa implementation
- Next by Date: Re: Newbie - itoa implementation
- Previous by thread: Re: Help me understand this compiler warning.
- Next by thread: Re: Help me understand this compiler warning.
- Index(es):
Relevant Pages
|