second draft: add Bitfields to D
Walter Bright
newshound2 at digitalmars.com
Sun Apr 28 18:06:36 UTC 2024
I listed these 3 use cases in the second draft, and it seems we are mostly in
agreement.
Using bit fields to reduce memory consumption, and to be compatible with C code,
is handled by default nicely with the proposal.
Conformance to an externally imposed layout sometimes is necessary, but it is
much less common. It is almost always easily done with a minor bit of attention.
The worst case is writing a shift/mask accessor function, very easy to do. I
suspect these workarounds are even less effort than reading the spec on how to
use special syntax for it. Nobody is obliged to use std.bitmanip.bitfield to get
the job done.
I can help with any externally defined format anyone is having difficulty with.
More information about the dip.development
mailing list