I use the following code to print an int64_t:
int64_t a = 100;
printf("%lld\n", a);
However, it produces a warning.
warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t'
So, I go into stdint.h and find the definition:
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__
typedef long long int int64_t;
# endif
THe problem is that I use '%lld' to print a 'long int' in 64bit system. Although simply using '%ld' solve the warning, it causes portability problem since it doesn't work in 32bit system ('%ld' accounts for 32 bits).
Is there any portable method to print int64_t?