Wouldn't this be better with bitfields?

Quirin Schroll qs.il.paperinik at gmail.com
Wed Jul 3 10:13:21 UTC 2024


On Wednesday, 3 July 2024 at 09:24:52 UTC, Dukc wrote:
> What if bitfields were moved from `std.bitmanip` to `core.*` 
> and the compiler would lower any bitfield declarations in 
> struct/class to a `bitfields` mixin?

Then there could even be `extern(C)` bitfields guaranteeing 
compatibility with the associated C compiler, and `extern(D)` 
bitfields guaranteeing portability. (`extern(C++)` bitfields 
would be the same as `extern(C)`, I guess.)

The `extern(C)` bitfields would have to be a compiler intrinsic, 
whereas the `extern(D)` ones could be a lowering to some mixin 
template in `core.bitfield`.


More information about the Digitalmars-d mailing list