DIP: add Bit Fields

Arafel er.krali at gmail.com
Fri Mar 8 09:46:52 UTC 2024


On 8/3/24 10:10, Jonathan M Davis wrote:
> Well, I guess that structs don't technically have extern(C) or extern(D) on
> them, which makes this harder (structs and classes do with extern(C++), but
> that doesn't help with C). Otherwise, the obvious thing would be to just use
> the C behavior in structs / classes that are extern(C) or extern(C++) and
> use well-defined, cross-platform behavior with extern(D) types, but it's the
> functions that are extern(*), not the types.

Isn't that already a solved problem? What happens currently when an 
`extern(D)` struct contains an `extern(C++)` class as a member? Or both 
`extern(D)` and `extern(C++)` classes?

```d
struct S {
     extern(C++) class C {}
     extern(D) class D {}

     C c;
     D d;
}

void main() {
     S s;
}
```

I don't see why we can't have something similar with `extern(D)` and 
`extern(C)` / `extern(C++)` bit fields.


More information about the dip.development mailing list