char array subscript in ctype

Ian Jeffray ian at jeffray.co.uk
Sat Dec 29 14:50:47 PST 2001


Peter Naulls wrote:

> When using libscl and certain combinations of warnings, the ctype
> isspace, etc. macros may give warnings about subscripts being of type
> 'char'.
> 
> I suggest a suitable cast in each macro.  e.g.:
> 
> #define isgraph(c) (__ctype[(unsigned int)c] & 58)



Conversely, those functions are documented as taking int's, so it's
probably better to fix the code you're compiling, rather than have the
compiler/headers hide the issue?  (IE, the headers should do what they
say on the tin - which they do right now)


Ian.





More information about the gcc mailing list