Looking for a bit of insight into the proper way to printf 64-bit values on both IA-32 and IA-64, ideally using the same code. Take for example:
#include<stdio.h> #include<stdint.h> int main(int argc, char **argv) { unsigned long int ul=~0UL; unsigned long long int ull=~0ULL; uint64_t ui64=~0ULL; printf("ul=%lx ull=%llx ui64=%llx\n", ul, ull, ui64); printf("ul=%lx ull=%lx ui64=%lx\n", ul, ull, ui64); return 0; } Using gcc-2.96-96 on an IA-64 platform, gcc gives me: gcc -o foo -Wall foo.c foo.c: In function `main': foo.c:9: warning: long long unsigned int format, uint64_t arg (arg 4) foo.c:10: warning: long unsigned int format, long long unsigned int arg (arg 3) On ia32, uint64_t is typedef'd to be unsigned long long int. On ia64, uint64_t is typedef'd to be unsigned long int. It so happens that on ia64, unsigned long long int is the same size (8 bytes) as is an unsigned long int. So, I don't want gcc complaining to me that the two are different. Generally I'd just ignore the warning, but in some apps that use -Werror, that's kind of hard. Since on ia32 I'd print a uint64_t using %llx, I'd like to be able to do the same on IA-64 without the warning, so I can keep the code the same. Thoughts? Thanks, Matt -- Matt Domsch PGP 17A4 17D0 81F5 4B5F DB1C AEF8 21AB EEF7 92F0 FC09 Sr. Software Engineer Dell Linux Solutions www.dell.com/linux #2 Linux Server provider with 17% in the US and 14% Worldwide (IDC)! #3 Unix provider with 18% in the US (Dataquest)! _______________________________________________ Redhat-devel-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-devel-list