bit fields

Walter Bright newshound2 at digitalmars.com
Wed Sep 1 04:49:49 UTC 2021


On 8/30/2021 12:40 PM, Paul Backus wrote:
> On Monday, 30 August 2021 at 18:39:20 UTC, Walter Bright wrote:
>> On 8/29/2021 11:32 PM, Elronnd wrote:
>>> On Saturday, 28 August 2021 at 08:20:25 UTC, Walter Bright wrote:
>>>> how gcc/clang do it is essentially undocumented
>>>
>>> x86-64-psABI, sec 3.1.2 (data representation)
>>
>> https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
>>
>> That only partially documents it. It doesn't cover things like alignment and 0 
>> length fields.
> 
> Zero-length bitfields are covered by the C standard:
> 
>> As a special case, a bit-field structure member with a width of 0 indicates 
>> that no further bit-field is to be packed into the unit in which the previous 
>> bit-field, if any, was placed.
> 
> Source: http://port70.net/~nsz/c/c99/n1256.html#6.7.2.1p11

Doesn't cover alignment, either. Doesn't cover what happens with a struct where 
the only member is a 0 bit field. Doesn't cover what a sequence of 2 or more 0 
bit fields does.


More information about the Digitalmars-d mailing list