Talk:Align fields (Delphi)

From RAD Studio
Jump to: navigation, search

Maybe you could add a bit more text/detail to the description of $ALIGN, because it is not entirely clear and can lead to a bit of confusion. Have a look at this thread: https://forums.embarcadero.com/thread.jspa?threadID=41486

The documentation here seems to conflict with that here: http://docwiki.embarcadero.com/RADStudio/en/Internal_Data_Formats#Record_Types

Specifically "In the {$A8} or {$A+} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on quad word boundaries."

To me that contradicts this:

"When a record type is declared in the {$A+} state (the default), and when the declaration does not include a packed modifier, the type is an unpacked record type, and the fields of the record are aligned for efficient access by the CPU, and according to the platform. The alignment is controlled by the type of each field . Every data type has an inherent alignment, which is automatically computed by the compiler. The alignment can be 1, 2, 4, or 8, and represents the byte boundary on which a value of the type must be stored in order to provide the most efficient access."

The latter text from Internal Data Formats matches what I believe the program to do.

Response

We are considering your suggestions. Thank you very much for your input! Please note that the Align fields page refers to FIELDS, but te Internal Data Formats page refers to TYPES.

KrisHouser 22:40, 16 January 2012 (PST)

RAD-10506