[libvirt] how to print size_t in LGPLv2+ program

Eric Blake eblake at redhat.com
Tue Aug 17 23:37:17 UTC 2010


On 08/17/2010 05:35 PM, Bruno Haible wrote:
>>> 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);
> 
> - Works fine with gnulib's <inttypes.h>.
> - Works fine with gettext.
> - Doesn't need gettext or glibc versions that don't exist yet.

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).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100817/0378d2aa/attachment-0001.sig>


More information about the libvir-list mailing list