Another comment on bitfields: be aware that the compiler must generate a
lot of code to access them and that this may eat up whatever memory you
save on the structs.

Case in point: Crosswords has about 20 Boolean fields in a struct that
represents a saved game, so there's one instance per game and maybe
three or four on a typical user's machine.  At first I did these as
bitfields, but at some point I changed them to vanilla Booleans to see
what impact there was on code size.  The result was that the binary
got 750 bytes smaller, and of course faster as well.  You'd need to be
keepin a lot of games around, at a savings of 17 bytes each, to get
back those 750 bytes.

--Eric House

******************************************************************************
* From the desktop of: Eric House, [EMAIL PROTECTED]                            *
*     Check out Crosswords for PalmOS: <http://www.peak.org/~fixin/xwords>   *
*          "The instructions said 'Win98 or better' -- so I installed Linux" *
******************************************************************************

Reply via email to