SLAA534A June 2013 – June 2020
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 | schar | 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 | int16 | 16 | 16 |
unsigned int | uint16 | 16 | 16 |
long , signed long | int32 | 32 | 16 |
unsigned long | uint32 | 32 | 16 |
long long, signed long long | int64 | 64 | 16 |
unsigned long long | uint64 | 64 | 16 |
enum | -- | varies (see Section 2.10) | 16 |
float | float32 | 32 | 16 |
double | float64 | 64 | 16 |
long double | float64 | 64 | 16 |
pointer | -- | varies (see Section 2.5) | 16 |
Generic names in the table are used in this specification to identify types in a language-independent way.
The char type is unsigned by default. This is in contrast to the "signed char" and "unsigned char" types, which specify their sign behavior. In the TI toolchain, the default for the "char" type can be changed using the
--plain_char=signed
compiler option.
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.
The additional types from C, C99 and C++ are defined as synonyms for standard types:
typedef unsigned int wchar_t;
typedef unsigned int wint_t;
typedef char * va_list;
See Section 2.5 for the sizes of the size_t and ptrdiff_t types, which are dependent on the selected code and data model.