isascii(3) macros and casts

Andreas Schwab schwab@suse.de
Wed Dec 11 15:40:34 GMT 2024


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.

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