Inline function definitions for isdigit and isxdigit?

Joseph Myers joseph@codesourcery.com
Thu Sep 15 18:03:00 GMT 2016


On Thu, 15 Sep 2016, Florian Weimer wrote:

> Can we provide inline definitions for isdigit and xdigit?
> 
> POSIX says (for the digit character class):
> 
> “
> In a locale definition file, only the digits <zero>, <one>, <two>, <three>,
> <four>, <five>, <six>, <seven>, <eight>, and <nine> shall be specified, and in
> contiguous ascending sequence by numerical value. The digits <zero> to <nine>
> of the portable character set are automatically included in this class.
> ”
> 
> This means it's fixed to '0' .. '9' for our purposes (our locales must be
> ASCII-transparent at least as far as the digits are concerned).

localedef should then disallow charmap files that aren't ASCII-transparent 
for digits, if it doesn't already.

> For xdigit, one can have more than two sequences of 'A' .. 'F' letters:
> 
> “
> In a locale definition file, only the characters defined for the class digit
> shall be specified, in contiguous ascending sequence by numerical value,
> followed by one or more sets of six characters representing the hexadecimal
> digits 10 to 15 inclusive, with each set in ascending order (for example, <A>,
> <B>, <C>, <D>, <E>, <F>, <a>, <b>, <c>, <d>, <e>, <f>).
> ”
> 
> But I wonder how useful this is in practice.  One might be tempted to define

It seems perfectly valid in accordance with POSIX, and we support users 
defining locales, so can't restrict functions to what's valid only for the 
locales shipped with glibc (whereas support for alternative charmaps is 
implementation-defined, so we can limit what we allow in charmap files).

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list