warnings from use of ctype.h methods

Joel Sherrill joel.sherrill@oarcorp.com
Mon Mar 15 13:50:00 GMT 2010


On 03/11/2010 05:26 PM, DJ Delorie wrote:
> In the case where you have a string, and you're explicitly checking for
> NUL elsewhere, the right thing to do is to map the data you have into
> the domain the function wants.  In this case, a cast to (unsigned char)
> gives your data the correct interpretation for the is*() functions.
>
> If you cast a plain char to an int, you get values in the set
> [-128..127], which is not the domain of values the is*() functions
> expect.  You should provide the is*() functions values in the set
> [0..255, EOF].
>    
Thanks for the very clear explanation.  I now
know how to proceed.

--joel



More information about the Newlib mailing list