Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-12

Re: Data alignment of records

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luis Fernando Del Aguila Mejía
I don't know what you mean by "registration data".

Sorry.

Can someone explain to me, about the Data alignment of records and other variables.

thanks.

Jonas Maebe
to Luis Fernando Del Aguila Mejía
Luis Fernando Del Aguila Mejía wrote
Can someone explain to me, about the Data alignment of records and other variables.

The alignment of records (and TP-style objects) is the same as alignment of its fields with the highest alignment requirement. For base types (integers, floating point types, pointers), the alignment depends on the target operating system. For Mac OS X and non-i386 systems, we follow the official ABI (application binary interface) of every system.

For i386-platforms other than Mac OS X, I guess we follow Delphi. I'm not sure whether these rules are documented anywhere, and they were probably implemented based on writing test programs.

Maybe a better question is: why do you want to know the alignment of different data types? Since it can change depending on which platform you are compiling for, writing your code assuming a particular alignment is generally a very bad idea.

Jonas