Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-18 Thread Bruno Haible
[removed bug-gnulib from CC] Eric Blake wrote: printf (% PRIuPTR, (uintptr_t) size_t_value); But still needs the use of need-formatstring-macros, and gettext 0.16.1 or newer (whereas libvirt is stuck on 0.14.1 at the moment). The uses of these formatstring macros require - at package

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-18 Thread Bruno Haible
Hi Eric, My understanding is that on 64-bit windows, sizeof(long)==4 but sizeof(void*)==8; and ... sizeof(size_t) is also 8. Yes, correct. Which means you _can't_ use %lu,(unsigned long)size_t_val. You _can_ use this. It will work as long as each of your program's data structures is less

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-18 Thread Ben Pfaff
Eric Blake ebl...@redhat.com writes: In a quick google search, I found this use of PRIdS (which is geared more for ssize_t, but the analog PRIuS would apply to size_t): http://bytes.com/topic/c/answers/506972-64-bit-portability-size_t-printf-format-strings However, S is awfully short; I'd

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-18 Thread Bruno Haible
What a shame that POSIX omitted an inttypes.h PRIu* for size_t. You can define it by yourself ... Or use uintptr_t instead of size_t. By the definition of these types, you can be sure that uintptr_t is at least as wide as size_t. Then use printf (% PRIuPTR, (uintptr_t) size_t_value); -

[libvirt] how to print size_t in LGPLv2+ program

2010-08-17 Thread Eric Blake
libvirt is currently LGPLv2+, but needs to use the printf family of functions to display size_t values, even on mingw where %zu support is not built in. My understanding is that on 64-bit windows, sizeof(long)==4 but sizeof(void*)==8; and if I'm reading

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-17 Thread Eric Blake
On 08/17/2010 03:47 PM, Paul Eggert wrote: On 08/17/10 23:17, Eric Blake wrote: libvirt is currently LGPLv2+ Can this be changed to LPGLv3+? That'd solve the problem. True, but it would have knock-on effects on all sorts of other clients of libvirt. I'm re-adding the libvirt list for

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-17 Thread Eric Blake
On 08/17/2010 04:33 PM, Bruno Haible wrote: What a shame that POSIX omitted an inttypes.h PRIu* for size_t. You can define it by yourself: Basically you define #if @BITSIZEOF_SIZE_T@ == 32 # define PRIuSIZE PRIu32 #endif #if @BITSIZEOF_SIZE_T@ == 64 # define PRIuSIZE PRIu64

Re: [libvirt] how to print size_t in LGPLv2+ program

2010-08-17 Thread Eric Blake
On 08/17/2010 04:33 PM, Bruno Haible wrote: Which means you _can't_ use %lu,(unsigned long)size_t_val. You _can_ use this. It will work as long as each of your program's data structures is less than 4 GB large. Remember that size_t values get larger than 4 GB only if you have a memory object