some unusual errors

Benjamin Riefenstahl
Sat Sep 19 14:52:00 GMT 1998

Hi Michael,

Michael Richardson wrote:
> I get a lot of warnings like this:
> strtod.c:1239: warning: subscript has type `char'
>   This line of code is actually:
>         for(s = s00; isspace(*s); s++)
>   which confuses me. What, if not "char" should isspace() take???

Several issues here.

a) Specification: The <ctype.h> functions all take "int"s in the range 0
to UCHAR_MAX plus EOF. This is the same range that getc() returns. It is
*not* the same range as "char", but OTOH "unsigned char" is a subset of
this range, so with regular strings one usually should cast like this

        for(s = s00; isspace((unsigned char)*s); s++)

b) The <ctype.h> functions are usually implemented as macros which look
up the answers in a static array. I think what the compiler complains
about is, that you use a (signed) "char" to index into an array where of
course no negative values are allowed for indexing. This is actually the
same issue as a), just some corners of the actual implementation later.

so long, benny
Benjamin Riefenstahl (
Crocodial Communications EntwicklungsGmbH
Ruhrstraße 61, D-22761 Hamburg, Germany
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list