From: benny AT crocodial DOT de (Benjamin Riefenstahl) Subject: Re: some unusual errors 19 Sep 1998 23:08:41 -0700 Message-ID: <3603E268.3CE39511.cygnus.gnu-win32@crocodial.de> References: <199809182005 DOT QAA03634 AT venus DOT solidum DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: gnu-win32 AT cygnus DOT 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 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 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 AT crocodial DOT 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 AT cygnus DOT com" with one line of text: "help".