The specification specifies the types int8_t
int16_t
int32_t
and int64_t
(and their unsigned variants) and follows them with:
These types are optional.
In C the type char
is at least 8 bits and short
and int
are at least 16 bits and long
is at least 32 bits and long long
is at least 64 bits. If they are all at least a certain width and at least as big as the smallest one, there could very well be for example an 8-bit type and a 32-bit type but no 16-bit type while satisfying those rules. As such could be 'gaps' in the fixed-width types?
By 'These types' do they mean each one individually or all of them as a whole? Could a conforming implementation define some but not all of the fixed width types? Do I have to worried about for example uint8_t
being defined but not uint16_t
?
Is it required that either all or none of the C fixed-width integer types to be defined?
No. An implementation may have CHAR_BIT == 16
and so only defined (u)int64_t
, (u)int32_t
and (u)int16_t
, yet not (u)int8_t
.
Do I have to worried about for example
uint8_t
being defined but notuint16_t
?
Don't worry about such unicorns.