This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: some unusual errors
- To: gnu-win32 at cygnus dot com
- Subject: Re: some unusual errors
- From: Benjamin Riefenstahl <benny at crocodial dot de>
- Date: Sat, 19 Sep 1998 18:57:12 +0200
- Organization: Crocodial Communications EntwicklungsGmbH
- References: <199809182005.QAA03634@venus.solidum.com>
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 (benny@crocodial.de)
Crocodial Communications EntwicklungsGmbH
Ruhrstraße 61, D-22761 Hamburg, Germany
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".