Signed arguments to isspace et al

Florian Weimer fweimer@redhat.com
Thu Sep 13 14:09:00 GMT 2012


Suppose c is a char and has a negative value distinct from EOF. 
According to the C standard, isspace(c) is undefined.  However, a lot of 
code doesn't perform the cast to unsigned char.  I wonder if we support 
this usage to some degree?

There's also the additional complicate that isalpha(EOF) and 
isalpha(255) mean two different things in many locales.  For instance, 
isalpha('ÿ') would probably return false in a ISO-8859-1 locale if 
running on an architecture with signed chars.  I expect that returning 
false for negative c would probably good enough.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libc-alpha mailing list