Exploring the philosophy of objects

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Jun 24 18:21:00 UTC 2022


On Friday, 24 June 2022 at 18:08:15 UTC, user1234 wrote:
> On Friday, 24 June 2022 at 15:14:44 UTC, Ola Fosheim Grøstad 
> wrote:
>> I don't think existing languages have good support for 
>> hardware. C++/C requires the compiler to use the same layout 
>> for fields in a record as the source.
>
> Please show me an alternative that allows to respect the 
> substitution principle.

The simple approach is to reserve space for the fields you want 
to be on the same cache line. The root cause for the C++ model is 
separate compilation. If the compiler knows the full class 
hierarchy then it can choose a different layout. That is obvious.



More information about the Digitalmars-d mailing list