It seems that uint32_t
is much more prevalent than uint_fast32_t
(I realise this is anecdotal evidence). That seems counter-intuitive to me, though.
Why do many people use
uint32_t
rather thanuint32_fast_t
?
Silly answer:
uint32_fast_t
, the correct spelling is uint_fast32_t
.Practical answer:
uint32_t
or int32_t
for their precise semantics, exactly 32 bits with unsigned wrap around arithmetic (uint32_t
) or 2's complement representation (int32_t
). The xxx_fast32_t
types may be larger and thus inappropriate to store to binary files, use in packed arrays and structures, or send over a network. Furthermore, they may not even be faster.Pragmatic answer:
uint_fast32_t
, as demonstrated in comments and answers, and probably assume plain unsigned int
to have the same semantics, although many current architectures still have 16-bit int
s and some rare Museum samples have other strange int sizes less than 32.UX answer:
uint32_t
, uint_fast32_t
is slower to use: it takes longer to type, especially accounting for looking up spelling and semantics in the C documentation ;-)Elegance matters, (obviously opinion based):
uint32_t
looks bad enough that many programmers prefer to define their own u32
or uint32
type... From this perspective, uint_fast32_t
looks clumsy beyond repair. No surprise it sits on the bench with its friends uint_least32_t
and such.