6.3.1.1 Boolean, characters, and integers

Previous Table of Contents

655 Every integer type has an integer conversion rank defined as follows:

656 —  No two signed integer types shall have the same rank, even if they have the same representation.

657 —  The rank of a signed integer type shall be greater than the rank of any signed integer type with less precision.

658 —  The 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.

659 —  The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type, if any.

660 —  The rank of any standard integer type shall be greater than the rank of any extended integer type with the same width.

661 —  The rank of char shall equal the rank of signed char and unsigned char.

662 —  The rank of _Bool shall be less than the rank of all other standard integer types.

663 —  The rank of any enumerated type shall equal the rank of the compatible integer type (see 6.7.2.2).

664 —  The 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.

665 —  For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has greater rank than T3, then T1 has greater rank than T3.

666 The following may be used in an expression wherever an int or unsigned int may be used:

667 —  An object or expression with an integer type whose integer conversion rank is less than or equal to the rank of int and unsigned int.

668 —  A bit-field of type _Bool, int, signed int, or unsigned int.

669 If an int can represent all values of the original type, the value is converted to an int;

670 otherwise, it is converted to an unsigned int.

671 These are called the integer promotions.48)

672 All other types are unchanged by the integer promotions.

673 The integer promotions preserve value including sign.

674 As discussed earlier, whether a “plain” char is treated as signed is implementation-defined.

675 Forward references: enumeration specifiers (6.7.2.2), structure and union specifiers (6.7.2.1).

Next

Created at: 2005-06-29 02:18:55 The text from WG14/N1124 is copyright © ISO