From: Lostgallifreyan <z....@bt...> - 2013-08-17 21:31:43
|
Eli Zaretskii <el...@gn...> wrote: (17/08/2013 19:20) >Please show some code and the compiler errors you get when you compile >it. It is best to show the shortest code that can be used to >reproduce the problem. > >In general, GCC does support 64-bit integral type, and 'unsigned long >long' is one such type. So the problem is in the details. > Thanks. I took awhile to make sure I got this reduced and also showign why I have trouble with it... #include <windows.h> unsigned long long X=22222222220000; //__int64 X=22222222220000; int main(){ printf("%d %d %d %d\n",X>0xFFFFFFFF,X==22222222220000,(X*2)==44444444440000,(X*2/10000)==4444444444); printf("%lu %lu %lu\n",X,X*2,X*2/10000); } To run that I used a batch file in Windows 98 and here's the text grabbed from the console window: C:\WINDOWS\Desktop>C:\WINDOWS\DESKTOP\TEST\TEST.BAT C:\WINDOWS\Desktop>E:\CODING\GCC\BIN\GCC.EXE -O3 --fast-math -IE:\Coding\gcc\inc lude C:\WINDOWS\DESKTOP\TEST\TEST.c -oC:\WINDOWS\DESKTOP\TEST\TEST.exe C:\WINDOWS\DESKTOP\TEST\TEST.c:2: warning: integer constant is too large for "lo ng" type C:\WINDOWS\DESKTOP\TEST\TEST.c: In function `main': C:\WINDOWS\DESKTOP\TEST\TEST.c:6: warning: integer constant is too large for "lo ng" type C:\WINDOWS\DESKTOP\TEST\TEST.c:6: warning: integer constant is too large for "lo ng" type C:\WINDOWS\DESKTOP\TEST\TEST.c:6: warning: integer constant is too large for "lo ng" type C:\WINDOWS\Desktop>C:\WINDOWS\DESKTOP\TEST\TEST.EXE 1 1 1 1 61430496 5174 122860992 C:\WINDOWS\Desktop> As well as all those warnings, due to the weirdness in the second line of printf output I can't be sure if the nice Boolean 1's on the first output indicate working innards, of just perfect comparisons between hidden identical garbage in place of the constants I thought I feeding it. Compiling with TCC gets identical results but without the warnings. The __int64 works exactly as does unsigned long long. Once I have a way to know I'm getting the right behaviour with no errors or warnings I will be able to use typedef to get my wanted QWORD based on whatever turns out to be the best method. |