Table 5-1 lists the size, representation, and range of each scalar data type for the ARM compiler. Many of the range values are available as standard macros in the header file limits.h.
Range | ||||
---|---|---|---|---|
Type | Size | Representation | Minimum | Maximum |
signed char | 8 bits | ASCII | -128 | 127 |
char (1) | 8 bits | ASCII | 0 (1) | 255 (1) |
unsigned char | 8 bits | ASCII | 0 | 255 |
bool, _Bool | 8 bits | ASCII | 0 (false) | 1(true) |
short, signed short | 16 bits | Binary | -32 768 | 32 767 |
unsigned short, wchar_t (2) | 16 bits | Binary | 0 | 65 535 |
int, signed int | 32 bits | Binary | -2 147 483 648 | 2 147 483 647 |
unsigned int | 32 bits | Binary | 0 | 4 294 967 295 |
long, signed long | 32 bits | Binary | -2 147 483 648 | 2 147 483 647 |
unsigned long | 32 bits | Binary | 0 | 4 294 967 295 |
long long, signed long long | 64 bits(3) | Binary | -9 223 372 036 854 775 808 | 9 223 372 036 854 775 807 |
unsigned long long | 64 bits(3) | Binary | 0 | 18 446 744 073 709 551 615 |
enum (TI_ARM9_ABI and TIABI only) (4) | 32 bits | Binary | -2 147 483 648 | 2 147 483 647 |
float | 32 bits | IEEE 32-bit | 1.175 494e-38(5) | 3.40 282 346e+38 |
double | 64 bits(3) | IEEE 64-bit | 2.22 507 385e-308(5) | 1.79 769 313e+308 |
long double | 64 bits(3) | IEEE 64-bit | 2.22 507 385e-308(5) | 1.79 769 313e+308 |
pointers, references, pointer to data members | 32 bits | Binary | 0 | 0xFFFFFFFF |
Negative values for signed types are represented using two's complement.
The type of the storage container for an enumerated type is the smallest integer type that contains all the enumerated values. The container types for enumerators are shown in Table 5-2.
Lower Bound Range | Upper Bound Range | Enumerator Type |
---|---|---|
0 to 255 | 0 to 255 | unsigned char |
-128 to 1 | -128 to 127 | signed char |
0 to 65 535 | 256 to 65 535 | unsigned short |
-128 to 1 | 128 to 32 767 | short, signed short |
-32 768 to -129 | -32 768 to 32 767 | |
0 to 4 294 967 295 | 2 147 483 648 to 4 294 967 295 | unsigned int |
-32 768 to -1 | 32 767 to 2 147 483 647 | int, signed int |
-2 147 483 648 to -32 769 | -2 147 483 648 to 2 147 483 647 | |
0 to 2 147 483 647 | 65 536 to 2 147 483 647 |
The compiler determines the type based on the range of the lowest and highest elements of the enumerator. For example, the following code results in an enumerator type of int:
enum COLORS
{ green = -200,
blue = 1,
yellow = 2,
red = 60000
};
The following code results in an enumerator type of short:
enum COLORS
{ green = -200,
blue = 1,
yellow = 2,
red = 3
};