DIP: add Bit Fields

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Mar 7 22:36:41 UTC 2024


On Thursday, March 7, 2024 3:28:34 PM MST Dennis via dip.development wrote:
> Why bow down to C and treat D as a second class citizen? The DIP
> should really substantiate this alleged importance of
> C-compatibility of non-ImportC D bitfields: Can you name at least
> one dub package that would benefit from bit fields with
> C-compatible layout?

Having the ability to declare C-compatible bitfields would definitely be
useful for binding some C symbols. I was recently dealing with some symbols
on Windows where I basically had to skip the bitfields when writing the
bindings, because I don't know of any way to bind to them in D.

That being said, I see no reason for bitfields for actual D code to be
C-compatible. Unless I'm actually binding to a C type, C-compatibility is
irrelevant, and if what C is doing isn't portable, then why would I want it
for my D code?

- Jonathan M Davis





More information about the dip.development mailing list