4.5 Integers

  • Any extended integer types that exist in the implementation (C99 and C11 6.2.5).

    GCC does not support any extended integer types.

  • Whether signed integer types are represented using sign and magnitude, two’s complement, or one’s complement, and whether the extraordinary value is a trap representation or an ordinary value (C99 and C11 6.2.6.2).

    GCC supports only two’s complement integer types, and all bit patterns are ordinary values.

  • The rank of any extended integer type relative to another extended integer type with the same precision (C99 and C11 6.3.1.1).

    GCC does not support any extended integer types.

  • The result of, or the signal raised by, converting an integer to a signed integer type when the value cannot be represented in an object of that type (C90 6.2.1.2, C99 and C11 6.3.1.3).

    For conversion to a type of width N, the value is reduced modulo 2^N to be within range of the type; no signal is raised.

  • The results of some bitwise operations on signed integers (C90 6.3, C99 and C11 6.5).

    Bitwise operators act on the representation of the value including both the sign and value bits, where the sign bit is considered immediately above the highest-value value bit. Signed ‘>>’ acts on negative numbers by sign extension.

    As an extension to the C language, GCC does not use the latitude given in C99 and C11 only to treat certain aspects of signed ‘<<’ as undefined. However, -fsanitize=shift (and -fsanitize=undefined) will diagnose such cases. They are also diagnosed where constant expressions are required.

  • The sign of the remainder on integer division (C90 6.3.5).

    GCC always follows the C99 and C11 requirement that the result of division is truncated towards zero.