On Sat, 12 Mar 2005, Serassio Guido wrote:

Two questions related to 64 bit printf()

- What about the use of PRIxxxxx macros for 64 bit format specifiers ?

- On Windows the 64 bit support is fine, but there is a problem with 64 bit printf() format specifiers:

Then we should use a printf replacement fixing this. We already have one replacement, but it doesnt support ll either..


So, i.e., on Windows the unsigned 64 bit format specifier is "I64u", on other system should be "llu".

Argh. Why is there standards, and why doesn't anyone care to implement them outside the free software?


I kind of assumed that if you have long long then you also have the corresponding format specifier.

I have already tried something like:

#define PRIu64 "I64u"
printf("this is a 64 bit int:"PRIu64"\n", value);

but gcc wasn't happy .....

the only working thing was:

#define PRIu64 "I64u"
char format[]="this is a 64 bit int:"PRIu64"\n";
printf(format, value);

Any suggestion ?

We could disable the GCC printf format checks on Windows. See the PRINTF_FORMAT_ARGn macros in include/config.h


Or alternatively don't allow large objects on Windows. Just need to fall back on using long.

Regards
Henrik

Reply via email to