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

From: Robert Moon (LegalWriter@earthlink.net)
Date: 12/26/99


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 line is put into context below, but first some background.
Essentially, I defined a simple boolean array to determine which empires
(hometowns) a new character may start out in based on his or her chosen race.

In limits.c:
int start_emp[NUM_EMPIRES][NUM_RACES] = {
  {1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0},      /* Narak */
  {0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0},      /* Loganis */
  {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},      /* Sillis */
  {1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1}               /* Jasperal */
};

In structs.h:
#define RACE_HUMAN      0
  <snip races 1-11>
#define RACE_ELF        12

#define NUM_RACES       13


#define EMP_NARAK       0
  <snip empires 1-2>
#define EMP_JASPERAL    3

#define NUM_EMPIRES     4


In interpreter.c, the errant line is called in nanny during character
creation, as follows (see the arrow <--- for errored line)

for (i = 0; i < NUM_EMPIRES; i++) {
  if (start_emp[i][GET_RACE(d->character)]) {     <----


If anyone can tell my I'm getting this error "warning: array subscript has
type 'char'", I'd be most appreciative.  Thanks.
--------------
ICQ:  14598527


     +------------------------------------------------------------+
     | 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