The point is that gcc does not complain about %lld, if it matches a 64-bit parameter of printf, as this is standard ANSI. But when at run time you do pass it to the library function for printf, it does not understand it properly, and prints a 32-bit integer. As this is the low word of the int64, you normally would not notice the difference, unless the number was > 2G. Or unless you printed something after it in the same printf call.
What happens when you do
Code: Select all
printf("%lld %d %d\n", (long long)3e9, 1, 2);
We have to use "%I64d %d %d" to make that work. But than it draws a compilaton warning that the parameter does not match the format.