On Thursday 28 February 2008 11:28, Michael Schnell wrote: > > AFAICS, it would be useful for bitpacked records only, so it could > > appear anywhere where a {PACKRECORDS} directive or similar can > > appear currently. > > IMHO it would only be useful (allowed with, regarded by) bitpacked > record, as any other data representation is supposed to be optimized > for speed according to the processor architecture.
Hmm, not necessarily. I frequently use enumeration types to express the meaning of a set of hardware bits. So thinking about it, what if I'd use enumerations in a bitpacked record? Maybe like this: -- 8< -- type // 2 bits. Enable_Set = (Dont_Care := 0, // 00 Disable := 1, // 01 Enable := 3); // 11 type Control = bitpacked record Continuous_Mode : Boolean; // bit 0/rightmost bit Alternate_Compare : Boolean; // bit 1 ... Enable_Mode : Enable_Set; // bit 14 .. 15/leftmost bits end; -- 8< -- I don't know if FPC can pack enumerations into a bitpacked record at all, but if it does, it might consider the bit order here, too. Consider something like: -- 8< -- var My_Set : Enable_Set; My_Record : Control; My_Set := My_Record.Enable_Mode; -- 8< -- How should the assignment be handled if the bit order for that bitpacked record is changed? Vinzent. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel