DIP: add Bit Fields

Walter Bright newshound2 at digitalmars.com
Mon Apr 22 06:53:01 UTC 2024


On 3/16/2024 2:40 PM, Timon Gehr wrote:
> In general, how to introspect on bitfields?

Currently, allMembers will get you the name of the bitfield, and you can use 
.offsetof and .alignof on it. The number of bits can be derived from the .max 
property. You'll know it's a bitfield if the .max property is less than the 
type.max.

 From those, the bit offsets can be determined, but one could reasonably ask for 
an easier way to get that.


More information about the dip.development mailing list