This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Inline function definitions for isdigit and isxdigit?


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

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 FULLWIDTH LATIN SMALL LETTER A (U+FF41) as a hexadecimal digit. But this does not make much sense because FULLWIDTH DIGIT ZERO (U+FF10) and the other double-width digits cannot be defined as hexadecimal digits. I wonder if all reasonable extension candidates for xdigit are similar.

Even for isxdigit, an inline definition would result in a shorter machine code sequence than the current implementation (maybe not if the result of the call to __ctype_b_loc can be reused). For isdigit, the case is even clearer, even with a shared __ctype_b_loc value.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]