Align fields (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index

Type

Switch

Syntax

{$A+}, {$A-}, {$A1}, {$A2}, {$A4}, or {$A8} {$ALIGN ON}, {$ALIGN OFF}, {$ALIGN 1}, {$ALIGN 2}, {$ALIGN 4}, or {$ALIGN 8}

Default

{$A8} {$ALIGN 8}

Scope

Local



Remarks

The $A directive controls alignment of fields in Delphi record types and class structures.

In the {$A1} or {$A-} state, fields are never aligned. All record and class structures are packed.

In the {$A2} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on word boundaries.

In the {$A4} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on double-word boundaries.

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.

Record type field alignment is described in the Delphi Language Guide.

Regardless of the state of the $A directive, variables and typed constants are always aligned for optimal access. In the {$A8} state, execution will be faster.

See Also

Personal tools
Newest Version: XE
In other languages