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


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


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