c - Are there fixed size integers in GCC? -
on msvc++ compiler, 1 can use __int8
, __int16
, __int32
, similar types integers specific sizes. extremely useful applications need work low-level data structures custom file formats, hardware control data structures , like.
is there similar equivalent can use on gcc compiler?
iso standard c, starting c99 standard, adds standard header <stdint.h>
defines these:
uint8_t - unsigned 8 bit int8_t - signed 8 bit uint16_t - unsigned 16 bit int16_t - signed 16 bit uint32_t - unsigned 32 bit int32_t - signed 32 bit uint64_t - unsigned 64 bit int64_t - signed 64 bit
i use these types time.
these types defined if implementation supports predefined types appropriate sizes , characteristics (which do).
<stdint.h>
defines types names of form (u)int_leastn_t
(types have at least specified width) , (u)int_fastn_t
(the "fastest" types have @ least specified width); these types mandatory.
if you're using old implementation doesn't support <stdint.h>
, can roll own; 1 implementation doug gwyn's "q8".
Comments
Post a Comment