This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warnings from use of ctype.h methods


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]