DIP: add Bit Fields

Walter Bright newshound2 at digitalmars.com
Mon Mar 11 18:12:58 UTC 2024


On 3/9/2024 1:41 AM, Dennis wrote:
> I've shown that it's a problem when using bit bitfields in D's very own standard 
> library (std.internal.unicode_tables)

I presume you mean

```
ulong x; // bit field sizes: 18, 12, 12, 4, 4, 4
```

https://github.com/dlang/phobos/pull/8880/files#diff-6649807e195867988f8292561430bf14abf6c9cf4cecbea53c7ac2fd436c3623R145

which is 64 bits. That should produce the same result across different C 
compilers, i.e. it shouldn't be a problem.

If I'm missing what the actual problem you've encountered is, please explain.


> and asked you to name one dub package that 
> would benefit from D bit fields having C layout, which you didn't do.

The D compiler itself would, so using it in the D front end will effortlessly 
work with the C++ gdc and ldc backends.



More information about the dip.development mailing list