[comp.sys.mac] Packed Booleans=1 byte not 1 Bit Warning!

sqphil@csvax.liv.ac.uk (03/01/88)

At work we have bought copies of both TML and Turbo Pascal and now I
even bought my own personal copy of Turbo. The problem is that in both
of these compilers a packed array of Booleans does not pack to the bit
level, but at the byte level i.e. 1-byte per Boolean. This causes a
problem with (at least) two Mac routines that I have tried to use.
The KeyScan routine returns a KeyMap composed of - you guessed it,
packed Booleans. You have to ignore most of what's returned and do
your own bit testing instead. The problem is greater in the Appletalk
ABusRecord declaration. the atpBitMap is declared as a BitMaptype,
which is a packed array of Boolean. This means that the record is
not the correct length and so the incorrect parameters are used by
the routine (its looking 7 bytes less than it ought!). This is
just a warning to anyone who may have come accross the problem and
not know what happened. We lost a couple of weeks work with the
latter one!  (the answer is to define your own record, with an
integer instead of a BitMap type, and then mess about with it a bit
when you fill in the parameters)
  

Phil Jimmieson
Computer Science Dept.
Liverpool University

Disclaimer: Nobody here listens to a word I say anyway...