Re: Quick check on signed promotion of bytes
- From: vippstar@xxxxxxxxx
- Date: Thu, 31 Jan 2008 02:48:28 -0800 (PST)
On Jan 31, 12:45 pm, t...@xxxxxxxxxxx wrote:
I have a byte called "x". I want byte "y" to be the complement ofThat won't happend, therefore the rest of your thoughts is false.
"x" (i.e. all the bits flipped).
Initially I wrote:
char unsigned x, y;
...
x = 72;
y = ~x;
But then I thought that the following might happen on your average
system (CHAR_BIT == 8, sizeof(int) == 4):
1) x is promoted to signed int.
Your code is perfectly valid.
.
- Follow-Ups:
- References:
- Quick check on signed promotion of bytes
- From: toe
- Quick check on signed promotion of bytes
- Prev by Date: Quick check on signed promotion of bytes
- Next by Date: Re: Quick check on signed promotion of bytes
- Previous by thread: Quick check on signed promotion of bytes
- Next by thread: Re: Quick check on signed promotion of bytes
- Index(es):