Code align (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index

Type

Switch

Syntax

{$CODEALIGN n}

Default

n is the alignment setting. The default alignment setting is represented as 0. The actual value is determined by the target architecture.

For Win32, the default value is 4.

Scope

Local


Remarks

{$CODEALIGN} sets the starting address for a procedure or function. The possible alignment settings are:

{$CODEALIGN 0} {$CODEALIGN 1} {$CODEALIGN 2} {$CODEALIGN 4} {$CODEALIGN 8} {$CODEALIGN 16}

For example, {$CODEALIGN 16} sets the code alignment to 16-byte boundaries.

Specifying {$CODEALIGN 1} sets 1-byte boundaries, in which case no gaps or fillers are generated.

For data alignment, use the {$ALIGN} directive.

Note: The .ALIGN 16 pseudo-instruction, which can be used in asm blocks, has the same signification as {$CODEALIGN 16}.

See Also