On 02/08/2011 01:34 PM, Ben Pfaff wrote:
> The INT_STRLEN_BOUND macro in Gnulib's intprops.h calculates the
> maximum number of bytes in a formatted integer, on the basis that
> the minus sign and each digit will occupy one byte.  If *printf
> is used for formatting integers, is this a good assumption
> outside of the C locale?  I do not see anything in the C or POSIX
> standards that say whether or not %d and similar format
> specifiers are allowed to use localized sign and digits.
> 
> It looks to me that glibc only localizes the results of integer
> format specifiers if the glibc-specific "I" flag is present.  I
> don't know whether that is true in every libc.

Good question.  Right now, INT_STRLEN_BOUND assumes that you will be
outputting only in the C locale ('-' is one byte, and "%'d" does not
result in thousands separators); we would definitely need to modify
things to accommodate alternate locales.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to