DIP: add Bit Fields

Walter Bright newshound2 at digitalmars.com
Sat Mar 9 07:51:08 UTC 2024


Sometimes, too many options is not helpful. This is one of those situations. The 
problem with implementation-defined layout is much more of a pedantic one than a 
pragmatic one, as I've explained elsewhere in this thread.

If one sticks with `int` bit fields, they behave the same across C compilers 
that I've seen. Just like ints are 32 bits.

We don't have an attribute to switch endianess. It's just not worth the added 
complexity.

If anyone is worried about exactly specifying the layout, using masking and 
shifting will guarantee it (absent endianess issues!).

We do not need to solve every detail, just go for the critical ones.


More information about the dip.development mailing list