From: a DOT gillett AT virgin DOT net (Andrew R. Gillett) Newsgroups: comp.os.msdos.djgpp Subject: Warnings (was Re: A nice trap! (2)) Date: Fri, 5 Jun 1998 00:21:53 +0100 Organization: Virgin Net News Service Lines: 57 Message-ID: References: <35715AA9 DOT 4222FD24 AT net4you DOT co DOT at> <35718841 DOT 1129 AT cs DOT com> <357488F9 DOT 6054 AT cs DOT com> NNTP-Posting-Host: 194.168.64.120 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In comp.os.msdos.djgpp, article <357488F9 DOT 6054 AT cs DOT com>, John M. Aldrich (fighteer AT cs DOT com) wrote: > Warnings are not something trivial to be ignored; any programmer that > doesn't take full advantage of a compiler's ability to tell him/her > what's wrong with a program is (IMHO) either ignorant or foolish. > Ignorance by itself, of course, is not a crime, but there are a > tremendous number of resources around here devoted to removing it as an > obstacle. :-) I'm foolish: gcc death.c -o death.exe -ljgmod -lalleg -Wall death.c: in function 'draw_sidebar_stuff': death.c:6377: warning: array subscript has type 'char' death.c:6378: warning: array subscript has type 'char' death.c:6379: warning: array subscript has type 'char' The offending lines look like this: textout (active_page, font, level[level_number][message_id].message1, 702, 520, 50); The level struct looks like this: struct level_struct { unsigned char action_directive; short action_parameter; short x_pos; short y_pos; char message1[12]; // char message2[12]; // Yes, I know this is very inefficient... char message3[12]; // }; struct level_struct level [51][700]; // 51 levels, max 700 actions per level And the bit that stores the necessary data: strcpy (level[n][21].message1, "Collect\0"); strcpy (level[n][21].message2, "the bonus!\0"); strcpy (level[n][21].message3, "\0"); (where n is the level number) I was never that great with strings. It works, though. How do I get rid of the warnings? Btw, there are more to come...