22.5 Integers

Implementation-Defined Behavior for Integers is covered in section G.3.5 of the ANSI C Standard.

The following table describes the amount of storage and range of various types of integers: (ISO 6.1.2.5)

Table 22-2. Integer Types
DesignationArchitectureSize (bits)Range
charAll8-128 ... 127
signed charAll8-128 ... 127
unsigned charAll80 ... 255
shortAll16-32768 ... 32767
signed shortAll16-32768 ... 32767
unsigned shortAll160 ... 65535
intdsPIC33C/E/F and dsPIC30F16-32768 ... 32767
dsPIC33A32-2147483648 ... 2147483647
signed intdsPIC33C/E/F and dsPIC30F16-32768 ... 32767
dsPIC33A32-2147483648 ... 2147483647
unsigned intdsPIC33C/E/F and dsPIC30F160 ... 65535
dsPIC33A320 ... 4294867295
longAll32-2147483648 ... 2147483647
signed long All32-2147483648 ... 2147483647
unsigned longAll320 ... 4294867295
long longAll64-9223372036854775808 ... 9223372036854775807
signed long longAll64-9223372036854775808 ... 9223372036854775807
unsigned long longAll640 ... 18446744073709551615

What is the result of converting an integer to a shorter signed integer, or the result of converting an unsigned integer to a signed integer of equal length, if the value cannot be represented? (ISO 6.2.1.2)

There is a loss of significance. No error is signaled.

What are the results of bitwise operations on signed integers? (ISO 6.3)

Shift operators retain the sign. Other operators act as if the operand(s) are unsigned integers.

What is the sign of the remainder on integer division? (ISO 6.3.5)

+

What is the result of a right shift of a negative-valued signed integral type? (ISO 6.3.7)

The sign is retained.