2.1. Data Types¶
2.1.1. Scalar Data Types¶
The table below lists the size and range of each scalar type as supported in the tiarmclang compiler. Many of the minimum and maximum values for each range are available as standard macros in the C standard header file limits.h.
The storage and alignment of data types is described in Object Representation.
Type |
Size |
Min Value |
Max Value |
---|---|---|---|
signed char |
8 bits |
-128 |
127 |
char unsigned char bool |
8 bits |
0 |
255 |
short signed short |
16 bits |
-32768 |
32767 |
unsigned short |
16 bits |
0 |
65535 |
int signed int long signed long |
32 bits |
-2147483648 |
2147483647 |
enum |
packed |
-2147483648 |
2147483647 |
unsigned int unsigned long wchar_t |
32 bits |
0 |
4294967295 |
long long signed long long |
64 bits |
-9223372036854775808 |
9223372036854775807 |
unsigned long long |
64 bits |
0 |
18446744073709551615 |
float |
32 bits |
1.175494e-38 |
3.40282346e+38 |
double long double |
64 bits |
2.22507385e-308 |
1.79769313e+308 |
pointers references data member ptrs |
32 bits |
0 |
0xFFFFFFFF |
Notes:
The “plain” char type has the same representation as either signed char or unsigned char. The -fsigned-char and -funsigned-char options control whether “plain” char is signed or unsigned. The default is unsigned.
The wchar_t type has the same representation as unsigned int. The tiarmclang runtime libraries do not support a 16-bit wchar_t type. Attempts to use the tiarmclang -fshort-wchar option may cause issues when linked with the tiarmclang runtime libraries.
64-bit data types is aligned on a 64-bit (8-byte) boundary.
Further discussion about the size of enum types can be found below in the Enum Type Storage.
Specified minimum values for floating-point types in the table above indicate the smallest precision value > 0.
Negative values for signed types are represented using two’s complement.
2.1.2. Enum Type Storage¶
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 the following table:
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 65535 |
256 to 65535 |
unsigned short |
-128 to 1 -32768 to -129 |
128 to 32767 -32768 to 32767 |
signed short |
0 to 4294967295 |
2147483648 to 4294967295 |
unsigned int |
-32768 to -1 -2147483648 to -32769 0 to 2147483647 |
32767 to 2147483647 -2147483648 to 2147483647 65536 to 2147483647 |
signed int |