On 16 Mar 2001, at 2:56, Frank Heckenbach wrote:
...but since we've decided to do packing at all, we should also do it "reasonable"...
One question is whether it is more "reasonable" to pack to bit or byte level. That is, should:
a : packed array [1..3] of 0..31;
...take two bytes or three? (It will take two if it's packed to the bit level, where each element uses five bits, or three if it's packed to the byte level, where each element uses eight bits. Presumably, an equivalent unpacked array would use twelve bytes, where each element uses four bytes if the "natural" word size is 32 bits.)
I suppose packing would be most "reasonable" if it packed to the bit level, as one could always explicitly pad to a byte boundary if desired, whereas it would take a fair programming effort (i.e., shifts and masks) to effect bit packing if GPC only packed to the byte level. I've used compilers that took the opposite approaches, and it seemed to me to be easier and cleaner from a user's programming perspective to work with the compiler that packed to the bit level.
Of course, that is easy for me to say, as I have no idea how hard it would be to implement either scheme in GPC! ;-)
-- Dave