Mail Archives: djgpp-workers/1999/06/13/10:30:02
> As far as I can tell, in src/libc/ansi/stdlib/strtol.c, strtol is
> sending signed chars to isspace, isupper, and isdigit. The effect of
> that is undefined.
I'm not sure I follow. strtol sends an int to ctype function, not a
signed char. Where exactly is the problem?
It's subtle. If s is a "char *" or "signed char *" and c is an int,
then after "c = *s;", c is -27. isdigit is only defined in the
range -1 to 255. (EOF is -1.)
In include/inlines/ctype.ha you can see that isfoo(baz) just does
"(__bar[(int)(baz) + 1] & ...)" so sending a number less than -1 is
not good.
While I am at it. My Solaris manual says that tolower/toupper are
defined for all ints, so toupper(123456789) returns 123456789.
Morten
- Raw text -