second draft: add Bitfields to D
Walter Bright
newshound2 at digitalmars.com
Sun Apr 28 06:44:41 UTC 2024
On 4/27/2024 12:12 AM, Jonathan M Davis wrote:
> Now, if we want to do something like have extern(C) bitfields and extern(D)
> bitfields so that we can have clean and consistent behavior in normal D
> code
D used to have its own function call ABI, because I thought I'd make a clean and
consistent one.
It turned out, nobody cared about clean and consistent. They wanted C
compatibility. For example, debuggers could not handle anything other than what
the associated C compiler emitted, regardless of what the debug info spec says.
There really is not a clean and consistent layout. There is only C
compatibility. Just like we do for endianess and alignment.
All of the portability issues people have mentioned are easily dealt with.
There is always writing functions that do shifts and masks as a last resort.
(Shifts and masks is what the code generator does anyway, so this won't cost any
performance.)
More information about the dip.development
mailing list