16 bit platform bug and binary compatibility issues

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 06/02/01


Found what is potentially a serious stock bug which would prevent
CircleMUD from operating on a 16 bit platform:

Directly preceding the level_exp() function in class.c is the following
#define which is used to calculate the experience of immortals:

/*
 * This is the exp given to implementors -- it must always be greater
 * than the exp required for immortality, plus at least 20,000 or so.
 */
#define EXP_MAX  10000000

The problem is that the experience for a player is stored in an int
which, on a 16 bit platform has a maximum value of 32767, significantly
lower than that of EXP_MAX.  This would make it quite impossible to make
someone an immortal with the advance command on a 16 bit platform.  This
also effectively prevents players from possibly advancing past level 7
(or even 6 or 5 depending on class) with the stock levels.

Of course the simple fix for this is to change experience from an int to
a long, but wait, won't this break binary compatibility on 16 bit
platforms?  The short answer is "no".  The reason?  We never _had_ binary
compatibilty for 16 bit platforms, CircleMUD was _always_ broken on 16
bit platforms.  This releases us from _any_ obligation to continue to
support such non-existant binary-compatibility.

After all, if CM was never 16 bit compatible it was most probably never
used to any reasonable extent on a 16 bit platform, otherwise this bug
would quickly have been discovered long ago.  Why should we support
backwards compatibility to a platform if that platform was never used to
run CM?

More specifically, ints can be freely converted to longs without having
to worry about sacrificing binary compatibility (this might have
implications on a 64 bit platform, any comments on this?).

Taking the prior assessment to a further level we can even go as far as
to begin making more widespread use of the bitvector_t and possibly other
types we were afraid of changing in stock CM in the past due to concerns
over maintaining binary-compatibility.

In short, by realizing that CM never really worked on a 16 bit platform,
it allows us the freedom to actually make it work on a 16 bit platform.

Regards, Peter

--
   +---------------------------------------------------------------+
   | 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/05/01 PST