char array subscript in ctype

Vincent Lefevre vincent at vinc17.org
Sun Dec 30 02:23:28 PST 2001


On Sat, Dec 29, 2001 at 22:50:47 +0000, Ian Jeffray wrote:
> 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'.
[snip]
> 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)

I completely agree. Using a char as an argument for isspace, etc
is a bug, in particular when char's are signed (some characters
may have negative values).

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



More information about the gcc mailing list