DIP: add Bit Fields
Dennis
dkorpel at gmail.com
Mon Mar 11 18:49:37 UTC 2024
On Monday, 11 March 2024 at 18:12:58 UTC, Walter Bright wrote:
> On 3/9/2024 1:41 AM, Dennis wrote:
> which is 64 bits. That should produce the same result across
> different C compilers, i.e. it shouldn't be a problem.
That's great, but it's not what the DIP says currently, which is
that the layout (for non-int) is implementation defined matching
a C compiler.
It makes the comparison with C's varying `int` size, but the
difference is that in that case, D sticks to its guns and keeps
`int` 32-bits even when C would make it 16-bit. Perhaps the DIP
could say: the layout in D is defined as X, which follows what C
compilers do in practice.
Then programmers can be comfortable relying on the layout.
> The D compiler itself would, so using it in the D front end
> will effortlessly work with the C++ gdc and ldc backends.
Those are extern(C++) classes, and they already have working
bitfields. They wouldn't be impaired by making bit fields in D
consistent and predictable.
More information about the dip.development
mailing list