Should I use stdint.h types?

Joe Nelson joe at
Fri Jan 24 02:38:57 UTC 2020

If I'm working in C99 should I use the [u]int{,_least,_fast}N_t types,
or continue using the C89 "classic" integer types?

My mental model of the classic types is this:

char		= (none, sign not specified)
signed char = int_least8_t
int         = int_fast16_t
short       = int_least16_t
long        = int_fast32_t
long long   = int_fast64_t (of course long long is itself C99)
size_t      = (depends on architectural factors)
offset_t    = (same as size_t but signed)

The stdint.h types clearly document intentions, although experienced C
programmers are probably aware of the portable range of each classic
type. The classic types are prettier, while the new types allow some
combinations that weren't expressible before, like int_least32_t.

I think I'd avoid the more rigid intN_t types because they don't exist
on all machines.

Any opinions?

More information about the Friends mailing list