warning: format ‘%lli’ expects argument of type ‘long long int’, but argument 4 has type ‘int64_t {aka long int}’ [-Wformat=]
I don't want to disable -Wformat but I do want to get rid from the warning. Is there a solution?
Yes, there is.
As the actual type underlying (u)int??_t is not generally known (apart from (u)int8_t, that is forcibly a char type as discussed above), the standard provides, in its slightly less than infinite wisdom
, type specific conversion specifiers as macros in chapter 7.8.1 "Macros for format specifiers" (same chapter for C99, C11 and C18).
They are defined as character string literals, and have a quite regular form.
In your case for an uint64_T it would be PRIu64 for printf and SCNu64 for scanf.
Being string literals, they will be concatenated with adjacent string literals in translation phase 6, and only contain the right conversion specifier, so it's up to you to provide the % and the format width and precision, e.g:
printf("Here's my uint64_t: %20" PRIu64 "\n", my_uint64);
Edit: changed slightly imprecise language