Why must bitfields sum to a multiple of a byte?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Aug 2 07:52:57 PDT 2012


On 8/2/12 9:48 AM, monarch_dodra wrote:
> On Thursday, 2 August 2012 at 12:38:10 UTC, Andrei Alexandrescu wrote:
>> On 8/2/12 5:26 AM, monarch_dodra wrote:
>>> One of the *big* reasons I'm against having a hand chosen padding, is
>>> that the implementation *should* be able to find out what the most
>>> efficient padding is on the current machine (could be 32 on some, could
>>> be 64 on some)
>>
>> In my neck of the woods they call that "non-portability".
>>
>> If your code is dependent on the machine's characteristics you use
>> version() and whatnot.
>
> Well, isn't that the entire point: Making your code NOT dependent on the
> machine's characteristics?
>
> By forcing the developer to chose the bitfield size (32 or 64), you ARE
> forcing him to make a choice dependent on the machine's characteristics.

I think that's backwards.

Andrei


More information about the Digitalmars-d-learn mailing list