isascii(3) macros and casts
Andreas Schwab
schwab@suse.de
Thu Dec 12 09:01:01 GMT 2024
On Dez 11 2024, Florian Weimer wrote:
> * Andreas Schwab:
>
>> On Dez 11 2024, Alejandro Colomar wrote:
>>
>>> Hi Andreas,
>>>
>>> On Wed, Dec 11, 2024 at 03:03:00PM +0100, Andreas Schwab wrote:
>>>> On Dez 11 2024, Alejandro Colomar wrote:
>>>>
>>>> > inline bool
>>>> > my_isdigit(int c)
>>>> > {
>>>> > unsigned char uc = c;
>>>> >
>>>> > return isdigit(uc);
>>>>
>>>> This is wrong for EOF.
>>>
>>> Is it? EOF is -1, which is converted to 255, which is not a digit.
>>
>> That depends on the locale's charset.
>
> At least in C11, isdigit must only return true for any of 0123456789.
It's still wrong for the other ctype macros.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list