This section describes the implementation-defined characteristics of integers. It corresponds to section ``F.3.5 Integers'' in the ANSI document.
Integers are represented as follows:
char == signed char unsigned char
short == signed short unsigned short
int == signed int == long == signed long unsigned int == unsigned long
When an integer is converted to a shorter signed integer, if the value cannot be represented, the excess bytes are truncated. For example if:
char c = (char) 0xabcdef;then the value of c is 0xef.
When an unsigned integer is converted to a signed integer
of equal length, if the value cannot be represented,
the conversion is the same, but the value is treated
like a signed number.
In bitwise operations on signed integers, each of the operands of a bitwise operation is subject to the ``usual arithmetic conversions''. Consequently, narrow integers are subject to ``integral promotions''. For example, a short is promoted into an int. If the value of the short is negative, the sign is extended in the int. After the promotion, bitwise operations on signed ints are applied as if they were applied on unsigned ints.
When integers are divided and the division is inexact, the sign of the remainder is the same as the sign of the dividend.
When a signed integral type with a negative value is right shifted, the sign is extended.