When declaring or using in an artithmetic expression an integer
constant expression in C of a type that’s defined in
stdint.h,
for instance uint64_t
, one could cast the integer to the desired
type (uint64_t)x
, or use a Macro for Integer Constant
Expressions
such as UINT64_C(x)
(where x
is an integer constant expression).
I’m more enclined to use the macro, however I’m wondering in what cases the two approaches are equivalent, differ, and what could go wrong. More precisely: is there a case where using one would lead to a bug, but not with the other?
Thanks!