[PATCH][RFC] Avoid table lookup in isascii, isxdigit.

Ondřej Bílka neleai@seznam.cz
Sun Apr 14 00:40:00 GMT 2013


On Fri, Apr 12, 2013 at 02:39:35PM -0700, Paul Eggert wrote:
> On 04/12/13 13:42, Rich Felker wrote:
> > #define isdigit(c) ((unsigned)(c)-'0'<10)
> 
> Unfortunately, this implementation mishandles some
> obscure usages, e.g.,:
> 
>    double eof = EOF;
>    return isdigit (eof);
> 
> on systems where the implementation raises a signal
> when converting an out-of-range floating-point value
> to unsigned.

How what I originaly wrote handles this? Even ancient gcc optimizes it
to code above. 
To gcc optimizing I found bug gcc 54491 and checked that what I wrote
avoids it.



More information about the Libc-alpha mailing list