On 27/07/2011 23.10, Luiz Henrique de Figueiredo wrote:
> =big
2500000000
> =string.format('%d', big)
-2147483648
[snip]
---------------------------------------------------------------------
#include <stdio.h>
#include <limits.h>
int main()
{
printf("long long width: %d bit\n", sizeof(long long) * CHAR_BIT );
long long nnn = 2LL << 30; /* 2^31 */
double ddd = nnn;
nnn = ddd; /* check round-trip */
printf( "ddd = %.0f\n", ddd );
printf( "nnn = %lld\n", nnn );
}
---------------------------------------------------------------------
And compiled it this way:
gcc test.c -c -O2 -Wall -pedantic -std=c90
gcc test.o -o test.exe -O2 -Wall -pedantic -std=c90
[snip]
So there must be some strange combination of compiler flags in the
standard makefile that makes GCC do the wrong thing for %lld in
printf.