[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
INT_STRLEN_BOUND and locales with *printf
From: |
Ben Pfaff |
Subject: |
INT_STRLEN_BOUND and locales with *printf |
Date: |
Tue, 08 Feb 2011 12:34:14 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
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.
Thanks,
Ben.
--
Ben Pfaff
http://benpfaff.org
- INT_STRLEN_BOUND and locales with *printf,
Ben Pfaff <=