SPRUIG8J January 2018 – March 2024
Table 5-1 lists the size, representation, and range of each scalar data type for the C7000 compiler. Many of the range values are available as standard macros in the header file limits.h.
The storage and alignment of data types is described in Section 6.2.1.
Range | ||||
---|---|---|---|---|
Type | Size | Representation | Minimum | Maximum |
char, signed char | 8 bits | ASCII | -128 | 127 |
unsigned char | 8 bits | ASCII | 0 | 255 |
_Bool, bool | 8 bits | ASCII | 0 (false) | 1 (true) |
short | 16 bits | Binary | -32 768 | 32 767 |
unsigned short | 16 bits | Binary | 0 | 65 535 |
int, signed int | 32 bits | Binary | -2 147 483 648 | 2 147 483 647 |
unsigned int, wchar_t | 32 bits | Binary | 0 | 4 294 967 295 |
long, signed long | 64 bits | Binary | -9 223 372 036 854 775 808 | 9 223 372 036 854 775 808 |
unsigned long | 64 bits | Binary | 0 | 18 446 744 073 709 551 615 |
long long, signed long long | 64 bits | Binary | -9 223 372 036 854 775 808 | 9 223 372 036 854 775 807 |
unsigned long long | 64 bits | Binary | 0 | 18 446 744 073 709 551 615 |
enum (1) | varies | Binary | varies | varies |
float | 32 bits | IEEE 32-bit | 1.175 494e-38(2) | 3.40 282 346e+38 |
float complex | 64 bits | Array of 2 IEEE 32-bit | 1.175 494e-38 for real and imaginary portions separately | 3.40 282 346e+38 for real and imaginary portions separately |
double | 64 bits | IEEE 64-bit | 2.22 507 385e-308(2) | 1.79 769 313e+308 |
double complex | 128 bits | Array of 2 IEEE 64-bit | 2.22 507 385e-308 for real and imaginary portions separately | 1.79 769 313e+308 for real and imaginary portions separately |
long double | 64 bits | IEEE 64-bit | 2.22 507 385e-308(2) | 1.79 769 313e+308 |
long double complex | 128 bits | Array of 2 IEEE 64-bit | 2.22 507 385e-308 for real and imaginary portions separately | 1.79 769 313e+308 for real and imaginary portions separately |
pointers, references, pointer to data members | 64 bits | Binary | 0 | 0xFFFFFFFFFFFFFFFF |
Negative values for signed types are represented using two's complement.
We recommend that your code use the C
standard integer types int64_t
and int32_t
(et
al.) when specific data type sizes are needed for portability across different
devices and compilers. These standard integer types are defined in stdint.h
, which is included as part of the C standard library support included the
Runtime Support Library.
The C7000 adopts the LP64 representational convention.
That is, the type int
is 32 bits, while long
and
pointer
types are 64 bits.
These additional types from C, C99 and C++ are defined as synonyms for standard types:
Type | Definition |
---|---|
size_t | unsigned long |
ptrdiff_t | long |
wchar_t | unsigned int |
wint_t | int |
va_list | char * |