SPRAB89A September 2011 – March 2014
Integral values use twos-complement representation. Floating-point values are represented using IEEE 754.1 representation. Floating-point operations follow IEEE 754.1 to the degree supported by the hardware.
Table 2-1 gives the size and alignment of C data types in bits.
Type | Generic Name | Size | Alignment |
---|---|---|---|
signed char | char | 8 | 8 |
unsigned char | uchar | 8 | 8 |
char | plain char | 8 | 8 |
bool (C99) | uchar | 8 | 8 |
_Bool (C99) | uchar | 8 | 8 |
bool (C++) | uchar | 8 | 8 |
short, signed short | int16 | 16 | 16 |
unsigned short | uint16 | 16 | 16 |
int, signed int | int32 | 32 | 32 |
unsigned int | uint32 | 32 | 32 |
long (32 bits), signed long | int32 | 32 | 32 |
unsigned long | uint32 | 32 | 32 |
long (40 bits) | int40 | 40 | 64 |
long long, signed long long | int64 | 64 | 64 |
unsigned long long | uint64 | 64 | 64 |
enum | -- | varies (see Section 2.9) | 32 |
float | float32 | 32 | 32 |
double | float64 | 64 | 64 |
long double | float64 | 64 | 64 |
pointer | -- | 32 | 32 |
Generic names in the table are used in this specification to identify types in a language-independent way.
The alignment values listed are default values. They apply in all cases except when a type is used inside a "packed" structure. All structure member types inside of a "packed" structure have an alignment of 8 bits.
The char type is signed.
The integral types have complementary unsigned variants. The generic names are prefixed with 'u' (e.g. uint32).
The type bool uses the value 0 to represent false and 1 to represent true. Other values are undefined.
In the former COFF ABI for C6000, the C type long was a 40-bit integer, corresponding to the longest native integer type of the original 62x hardware. By default, the EABI changes long to 32 bits to be compatible with universal unwritten convention. However, toolchains may wish to support compatibility with legacy codes developed under the COFF ABI by supporting an optional 40-bit type, designated as long or otherwise, so the representation is described here. Notice that this type has a size of 40 bits but an alignment of 64 bits. If the 40-bit long type is used for a member of a "packed" structure, the type has an 8-bit alignment but a 64-bit container size.
The additional types from C, C99 and C++ are defined as synonyms for standard types:
typedef unsigned int size_t;
typedef int ptrdiff_t;
typedef unsigned int wchar_t;
typedef unsigned int wint_t;
typedef char * va_list;