Date: Sun, 13 Jun 1999 16:29:41 +0200 (METDST) Message-Id: <199906131429.QAA09339@tyr.diku.dk> From: Morten Welinder To: eliz AT is DOT elta DOT co DOT il CC: djgpp-workers AT delorie DOT com In-reply-to: (message from Eli Zaretskii on Sun, 13 Jun 1999 11:51:05 +0300 (IDT)) Subject: Re: strtol References: Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > 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