Stanislav Blinov wrote:

>> But bitfields in C may not use the same alignments used by
>> bitfields!() on DMD so I think you have to test the sanity of the
>> whole thing for each combination of D compiler, operating system and C
>> compiler.
>
> hm... what alignments are you talking about? bitfields template uses the
>  smallest suitable type for all fields, which is uint for the above
> struct. The trouble may come from bit order, mayhaps. bitfields
> positions fields in LSb order.

There is almost no guarantee in C (and C++) on how the bitfields are layed out.

I had implemented a C++ template solution once just to overcome that lack of layout. We needed to have our bits layed out exactly in certain ways.

Ali

Reply via email to