bit fields

Kagamin spam at here.lot
Tue Aug 31 20:13:09 UTC 2021


On Tuesday, 31 August 2021 at 01:04:57 UTC, Paul Backus wrote:
> On Monday, 30 August 2021 at 22:45:36 UTC, TheGag96 wrote:
>> On Saturday, 28 August 2021 at 08:20:25 UTC, Walter Bright 
>> wrote:
>>> 3. DasBetterC is not in a great place since it can't do 
>>> matching bit fields.
>>
>> I think I may be experiencing a bug in a betterC project of 
>> mine as a result of me assuming that `bitfields` is doing the 
>> same thing as gcc would...! Is there a way I can get things 
>> synced up on at least one platform in the meantime?
>
> Don't use bitfields for anything that needs to have a stable 
> ABI. They're not even guaranteed to have the same layout when 
> using the same compiler on different platforms [1], much less 
> between different languages.
>
> [1] https://yarchive.net/comp/linux/bitfields.html

Then maybe introduce a bitfields with a keyword indicating that 
it's not cross platform?

__bitfields bool a:1, b:1, c:1, d:1;


More information about the Digitalmars-d mailing list