DIP: add Bit Fields
MrSmith
mrsmith33 at yandex.ru
Mon Mar 25 16:39:49 UTC 2024
On Thursday, 7 March 2024 at 04:26:56 UTC, Walter Bright wrote:
> https://github.com/WalterBright/documents/blob/master/bitfields.md
My list of wishes:
1. bitfields imported from C should use `extern(C)`, this way
they can use whatever layout C compiler uses.
2. D bitfields should be `extern(D)`, and work like `bitfields`
mixin.
3. Allow specifying default value.
Here is how C3 language does bitfields:
https://c3lang.github.io/c3docs/types/#bitstructs
It has guaranteed layout, allows specifying endinanness, optional
overlaping of fields. It allows static arrays to be used as a
backing type. Its bitfields are done trough a special kind of
struct - `bitstruct`.
More information about the dip.development
mailing list