[fpc-pascal] Memory alignment with FPC

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 10 14:53:47 CEST 2012


On 10 Oct 2012, at 14:31, dhkblaszyk at zeelandnet.nl wrote:

> Jonas and Sven... Endianess is indeed an issue I will be handling.  
> It's
> my understanding now that by storing data in a packed record I will  
> have
> the same behaviour (when it comes to aligning data in memory) over all
> platforms and architectures. Same applies to packed objects. However
> when objects have methods, does that change memory alignment (compared
> to different architectures)? Is there any impact when I start using
> object inheritance?

You should never write objects containing VMTs to disk as a whole,  
that will only lead to trouble. Inheritance does not introduce VMTs in  
objects, but virtual methods, constructors and destructors do.

> One more
> question, when using packed records, is there anything to say about
> performance? Are there some tests anywhere that show how the  
> performance
> is impacted?


It will depend on the target platform, the order of the fields and  
types of the fields. It is impossible to say in general what the  
impact will be. It can be very large or non-existent.


Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20121010/c58e05cb/attachment.html>


More information about the fpc-pascal mailing list