Reordered class fields?

Jacob Carlborg doob at me.com
Mon Oct 22 04:06:49 PDT 2012


On 2012-10-22 10:48, bearophile wrote:

> This page says:
> http://dlang.org/class.html
>
>> The D compiler is free to rearrange the order of fields in a class to
>> optimally pack them in an implementation-defined manner. Consider the
>> fields much like the local variables in a function - the compiler
>> assigns some to registers and shuffles others around all to get the
>> optimal stack frame layout. This frees the code designer to organize
>> the fields in a manner that makes the code more readable rather than
>> being forced to organize it according to machine optimization rules.
>> Explicit control of field layout is provided by struct/union types,
>> not classes.<

Ok, I didn't know that.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list