Well, I don't use dev-cpp for windows console apps and I hadn't tried it. (I use command line cygwin gcc for most things.)Originally Posted by swoopy
Here's what I found about printing 64-bit ints with dev-cpp:
No need to "update". I doubt that it would change things. Format type specifiers can be found (the "right way") in <inttypes.h> (which includes <stdint.h>)
Here's something that runs on dev-cpp and other gnu gcc on my Windows XP box:
output isCode:#include <stdio.h> #include <inttypes.h> uint64_t make_longlong(uint32_t, uint32_t); int main () { uint64_t start, end, diff; uint32_t hi, lo; hi = 0x12345678; lo = 0x9abcdef0; start = make_longlong(hi, lo); hi = 0x55555555; lo = 0x11111111; end = ((uint64_t)hi << 32) | lo; diff = end - start; printf("end = %"PRIu64" (%"PRIx64" hex)\n",end, end); printf("start = %"PRIu64" (%"PRIx64" hex)\n",start, start); printf("diff = %"PRIu64" (%"PRIx64" hex)\n",diff, diff); getchar(); return 0; } /* if you want to make a function to hide the bit shifting * here's a possibility */ uint64_t make_longlong(uint32_t hi, uint32_t lo) { return ((uint64_t)hi << 32) | lo; }
Regards,Code:end = 6148914690091192593 (5555555511111111 hex) start = 1311768467463790320 (123456789abcdef0 hex) diff = 4837146222627402273 (4320fedc76543221 hex)
Dave



LinkBack URL
About LinkBacks



