C bitfields guarantees

Timon Gehr timon.gehr at gmx.ch
Wed Jul 10 12:02:47 UTC 2024


On 7/10/24 08:53, Walter Bright wrote:
> On 7/9/2024 5:32 PM, Timon Gehr wrote:
>>> The offset of `y` does not even respect its alignment! This is insanity.
> 
> That's right. It's not a bug, it matches what the associated C compiler 
> does.

Nonsense. The issue is the inconsistency between `S.y.alignof` and 
`S.y.offsetof`. In C, neither `offsetof` nor `alignof` work with 
bitfields in the first place, so the question does not even pose itself.


More information about the Digitalmars-d mailing list