Re: VERY Annoying Warnings

From: Mike Breuer (mbreuer@new.rr.com)
Date: 11/17/01


----- Original Message -----
From: "Ramsey Stone" <ramseystone@HOTMAIL.COM>


> #define LVL_IMMORT      201
> #define LVL_IMMORTAL    201
-- snip --

If you REALLY want to double up your definitions, consider doing it like
this:

#define LVL_IMMORT 201
#define LVL_IMMORTAL LVL_IMMORT

That way, they can't get out of sync when you're editing code at 1:00am.

> act.wizard.c:2497: warning: comparison is always true due to limited range
> of data type
> act.wizard.c:2608: warning: comparison is always false due to limited
range
> of data type

I can't give a definite answer unless you show me the actual code on these
lines, but most likely you are running into a limitation with the level
being declared as a char (or a byte, which is typedef'd as a char), which
has a range of -128 to 127.  If you make it unsigned, it'll have a range of
0-255, which should solve your problem without increasing the size of your
structures.  This is especially important if you haven't implemented some
sort of ASCII player file system, since increasing the variable size above 8
bits would make your files invalid.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST