Edited to remove the first warning
The following code works as expected in g ++ 4.4.0 under the name mingw32:
#include <cstdio> int main() { long long x = 0xdeadbeefc0defaceLL ; printf ("%llx\n", x) ; }
But if I turn on all warnings using -Wall , it says:
f.cpp: In function 'int main()': f.cpp:5: warning: unknown conversion type character 'l' in format f.cpp:5: warning: too many arguments for format
Same with the %lld . Is this fixed in newer versions?
Edited again to add:
The warning does not disappear if I specify -std=c++0x , although (i) long long is the standard type, and (ii) %lld and %llx seem to be officially supported. For example, from 21.5 Numeric Conversions , clause 7:
Each function returns a string object holding the character representation of the value of its argument that would be generated by calling sprintf(buf, fmt, val) with a format specifier of "%d", "%u", "%ld", "%lu", "%lld", "%llu", "%f", "%f", or "%Lf", respectively, where buf designates an internal character buffer of sufficient size.
So this is a mistake?
source share