Consider this code:
typedef int64_t Blkno;
#define BLKNO_FMT "%lld"
printf(BLKNO_FMT, (Blkno)some_blkno);
This works well and fine on x86. On x64, int64_t is actually a long
, rather than a long long
, and while long
and long long
are the same size on x64, the compiler generates an error:
src/cpfs/bitmap.c:14: warning: format ‘%lld’ expects type ‘long long int’, but argument 6 has type ‘Blkno’
- How can I tell
printf
that I'm passing a 64bit type? - Is there some better way to standardize specs for user types than using a
#define
likeBLKNO_FMT
as above?