Class Instance allocations

Justin Johansson no at spam.com
Wed Jan 13 12:37:35 PST 2010


Robert Jacques wrote:
> On Wed, 13 Jan 2010 10:29:35 -0500, Justin Johansson <no at spam.com> wrote:
> 
>> I understand your quandary.
>>
>> For me "Win32" == "32 bits" == "4 bytes" == "sizeof(ubiquitous machine 
>> register)".
>>
>> So why on earth, since Visual Studio 2001 (and before?), was the 
>> default alignment set to 8 bytes for the M$ C/C++ compiler code 
>> generation option?  This I just do not understand (so, of course, 
>> enlightenment is welcome).
>>
>> Beers for the New Years,
>>
>> Justin Johansson
> 
> If I recall correctly, doubles require 8-byte alignment. So you object 
> therefore must require 8-byte alignment.

Instances of my Foo class require 17 bytes so therefore all objects 
require 17 byte alignment.  But for my Bar class it's 42.

???



More information about the Digitalmars-d mailing list