I had a question about the topics in the subject and posted to
comp.std.c, but feel it may also be appropriate here. Please excuse
this crosspost if it is in bad form.
I have a question about whether or not I am interpreting a nuance of
the standard correctly, and the implications of said nuance. The
sections in the C99 standard (and possibly older standards) that I will
reference are as follows (typed out hopefully to avoid people having to
flip through their own manuals; if you want to fast forward to the meat
of this post, skip down to "-------end reference-------" line):
For signed integer types, the bits of the object representation shall
be divided into three groups: value bits, padding bits, and the sign
bit. There need not be any padding bits; there shall be exactly one
sign bit. Each bit that is a value bit shall have the same value as the
same bit in the object representation of the corresponding unsigned
type (if there are M value bits in the signed type and N in the
unsigned type, then M)...
Every integer type has an integer conversion rank defined as follows:
o two signed integer types shall have the same rank, even if they
have the same representation.
he rank of a signed integer type shall be greater than the rank of
any signed integer type with less precision.
he rank of long long int shall be greater than the rank of long
int, which shall be greater than the rank of int, which shall be
greater than the rank of short int, which shall be greater than the
rank of signed char.
he rank of any unsigned integer type shall equal the rank of the
corresponding signed integer type, if any.
he rank of any standard integer type shall be greater than the rank
of any extended integer type with the same width.
he rank of char shall equal the rank of signed char and unsigned
he rank of_Bool shall be less than the rank of all other standard
he rank of any enumerated type shall equal the rank of the
compatible integer type (see 22.214.171.124).
he rank of any extended signed integer type relative to another
extended signed integer type with the same precision is
implementation-defined, but still subject to the other rules for
determining the integer conversion rank.
or all integer types T1, T2, andT3, if T1 has greater rank than T2
and T2 has greater rank than T3, then T1 has greater rank than T3.
Otherwise, the integer promotions are performed on both operands. Then
the following rules are applied to the promoted operands:
If both operands have the same type, then no further conversion is
Otherwise, if both operands have signed integer types or both have
unsigned integer types, the operand with the type of lesser integer
conversion rank is converted to the type of the operand with greater
Otherwise, if the operand that has unsigned integer type has rank
greater or equal to the rank of the type of the other operand, then the
operand with signed integer type is converted to the type of the
operand with unsigned
Otherwise, if the type of the operand with signed integer type can
represent all of the values of the type of the operand with unsigned
integer type, then the operand with unsigned integer type is converted
to the type of the
operand with signed integer type.
Otherwise, both operands are converted to