Why must butfields sum to a multiple of a byte?

Ali Çehreli acehreli at yahoo.com
Mon Jul 30 09:07:11 PDT 2012


On 07/30/2012 07:19 AM, Andrej Mitrovic wrote:

 > I was thinking of cases where I'm wrapping a C++ POD struct which has
 > bitfields and is packed on a 1-byte boundary.

It is inherently unportable because unlike D, bitfields in C and C++ 
give too much freedom to the compiler. The compiler can move the fields 
around at will.

Ali



More information about the Digitalmars-d-learn mailing list