Re: [CODE] Warning: array subscript has type 'char'

From: Ron Hensley (ronh@intercom.net)
Date: 12/27/99


Or fix what it's warning about, by telling C what type to convert to.
Array subscripts are supposed to be integers, so telling it specifically
to convert the char/byte race variable to an integer before using it as
an array subscript will shut C up :P


  if (start_emp[i][(int)(GET_RACE(d->character))]) {

On Mon, 27 Dec 1999, George Greer wrote:

> On Sun, 26 Dec 1999, Robert Moon wrote:
>
> >I am receving an error message that I don't understand why.  The message is
> >"warning: array subscript has type 'char'" for the line:
> >
> >  if (start_emp[i][GET_RACE(d->character)]) {
>
> The race variable is a 'byte' or 'char'.  Use -Wno-char-subscripts (if you
> use GCC). Newer CircleMUD configure scripts (bpl14+ I think) catch that
> automatically.
>
> --
> George Greer            | My desktop computer project code.
> greerga@circlemud.org   | http://moving.m-l.org/~greerga/
>
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>      +------------------------------------------------------------+
>


--------------------------------------------------------------------------
Ron Hensley  (ronh@intercom.net)
Network Administrator - ICNet Internet Services
--------------------------------------------------------------------------


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST