Should I use stdint.h types?

Joe Nelson joe at
Sat Jan 25 05:49:04 UTC 2020

June Bug wrote:
> It’s not the ‘80s or ‘90s anymore and unless you’re writing
> specifically for embedded platforms it’s safe to assume that int is
> “big enough”.

Hah, fair enough. The books I read about C portability were from the
80s and 90s, so I think that's where I got the caution from. :)

> The _least and _fast variants also don’t seem generally applicable.
> I’ll usually only use stdint.h types if some algorithm (such as a
> hash function) or data format (such as PNG) calls for a specific
> size like uint32_t.

The only "danger" is that uint32_t might not exist, while uint_fast32_t
is more flexible and can choose a bigger type if it exists. It'll still
be big enough. However in reality what platform doesn't have uint32_t,
it would have to be very weird.

More information about the Friends mailing list