Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!futures!scott From: scott@futures.UUCP (Scott Boyd) Newsgroups: comp.sources.games.bugs Subject: Re: Scrabble diffs for non-ansi C compilers (tty.c bug) Summary: tty.c bug fix for scrabble Keywords: scrabble diffs C Message-ID: <134@futures.UUCP> Date: 4 May 89 21:31:07 GMT References: <133@futures.UUCP> Reply-To: scott@futures.UUCP (Scott Boyd) Organization: Commodity Futures, Inc. Woodside, CA Lines: 59 I've received some email about a problem with the file tty.c after the non-ansi C diffs are applied to Wayne Christopher's scrabble program. This seems to be problem with some C compilers that won't allow an enumerated type to be used as an array subscript. Most compilers issue a warning and go on, but some are stopped dead in their tracks. I'm posting this trivial patch, because the error message generated is rather confusing. Below is an example of the problem, plus a patch. ------------------------------------------------------------------------------- Scott Boyd Commodity Futures, Inc. uunet!futures!scott P.O. Box 620484 Woodside, CA 94062 ------------------------------------------------------------------------------- Here's the problem: cc -DDICT_FILE=\"/usr/dict/words\" -I. -I../include -g -c tty.c "tty.c", line 104: operands of + have incompatible types "tty.c", line 104: illegal indirection "tty.c", line 108: operands of + have incompatible types "tty.c", line 108: illegal indirection Here's the patch: *** tty.c.last Thu May 4 14:12:40 1989 --- tty.c Thu May 4 11:33:22 1989 *************** *** 101,111 **** for (j = 0; j < 15; j++) { bpos(x, y, i, j); wmove(boardwin, y, x - 1); ! waddch(boardwin, lbchar[board->bonus[j][i]]); wmove(boardwin, y, x); waddch(boardwin, '.'); wmove(boardwin, y, x + 1); ! waddch(boardwin, rbchar[board->bonus[j][i]]); } /* Draw the scores display... */ --- 101,111 ---- for (j = 0; j < 15; j++) { bpos(x, y, i, j); wmove(boardwin, y, x - 1); ! waddch(boardwin, lbchar[(int)board->bonus[j][i]]); wmove(boardwin, y, x); waddch(boardwin, '.'); wmove(boardwin, y, x + 1); ! waddch(boardwin, rbchar[(int)board->bonus[j][i]]); } /* Draw the scores display... */ -- ------------------------------------------------------------------------------- Scott Boyd Commodity Futures, Inc. uunet!futures!scott P.O. Box 620484 Woodside, CA 94062