Why must bitfields sum to a multiple of a byte?

Era Scarecrow rtcvb32 at yahoo.com
Tue Jul 31 09:15:59 PDT 2012


On Tuesday, 31 July 2012 at 15:25:55 UTC, Andrej Mitrovic wrote:
> On 7/31/12, monarch_dodra <monarchdodra at gmail.com> wrote:
>> The bug is only when the field is EXACTLY 32 bits BTW. 
>> bitfields works quite nice with 33 or whatever. More details 
>> in the report.
>
> Yeah 32 or 64 bits, thanks for changing the title.

  I wonder, is it really a bug? If you are going to have it fill a 
whole size it would fit anyways, why even put it in as a 
bitfield? You could just declare it separately.

  I get the feeling it's not so much a bug as a design feature. If 
you really needed a full size not aligned with whole bytes (or 
padded appropriately) then I could understand, but still...


  And I'm the one that changed the title name. Suddenly I'm 
reminded of south park (movie) and the buttfor.


More information about the Digitalmars-d-learn mailing list