<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>On 10 okt '12, Sven Barth wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>Am 10.10.2012 12:02, schrieb <a href="mailto:dhkblaszyk@zeelandnet.nl:">dhkblaszyk@zeelandnet.nl:</a></pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">Does FPC ensure the same memory alignment for records and objects over different platforms? If I want to be sure to have the same alignment must I use packed (with possibly some aligning assigned) records instead in combination with data types that are guaranteed to be of the same size over the different platforms (eg byte, word, single) ? Or do unpacked records behave the same over different platforms?</blockquote>
<pre>Please note that you might also need to take care of different endianess 
(big endian vs. little endian) if you want to transfer such record data 
(e.g. through files) between systems with different endianess. In that 
case you'll need to write the record field by field and convert the 
endianess in one of the two cases...

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<p>Thanks 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?</p>
<p> </p>
<p>The background behind my questions is the implementation of an IFF reader/writer in FPC. The reader/writer will be generated from available data types (simple ones as well as objects and records). To simplify the code I want to make use of the abstraction that FPC gives me.</p>
<p> </p>
<p>Regards, Darius</p>
<p> </p>
<div> </div>
</body></html>