[fpc-pascal] FPC Advanced Records

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Mar 9 23:13:45 CET 2012

Jonas Maebe wrote:
> On 09 Mar 2012, at 22:26, Mark Morgan Lloyd wrote:
>> Thanks Jonas, I don't think I need to do it but I thought it was a fair question: better safe than sorry.
>> OK, so hopefully I can get away with another. I'm looking at a program written in Delphi, which reads a file containing the image of an IBM mainframe tape. This has a record:
>> Type TAWSHeader=Record
>>       ThisSize: Word;
>> ..
> If you want a record to have a predictable layout, always either
> a) use {$packrecords c} if it's a translation of a C struct, or
> b) declare it as "packed"
> In other cases, you can (and will) have problems across different platforms or even compiler versions.

Thanks Jonas, noted (although I invariably put lots of Assert(SizeOf()=) 
in initialization). It's actually pretty simple stuff, but derives from 
a card IBM designed which had a mainframe (big-endian) processor on it 
but plugged into an MCA (little-endian) system.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list