Why must bitfields sum to a multiple of a byte?
Ali Çehreli
acehreli at yahoo.com
Tue Jul 31 13:13:57 PDT 2012
On 07/31/2012 09:15 AM, Era Scarecrow wrote:
> 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.
It can happen in templated code where the width of the first field may
be a template parameter. I wouldn't want to 'static if (width == 32)'.
But thanks for fixing the bug already! :)
Ali
More information about the Digitalmars-d-learn
mailing list