12.6 Unaligned typecasts

A special typecast is the Unaligned typecast of a variable or expression. This is not a real typecast, but is rather a hint for the compiler that the expression may be misaligned (i.e. not on an aligned memory address). Some processors do not allow direct access to misaligned data structures, and therefor must access the data byte per byte.

Typecasting an expression with the unaligned keyword signals the compiler that it should access the data byte per byte.

Note that the compiler assumes that access to all fields/elements of packed data structures is unaligned.


program me;  
  A : packed Array[1..20] of Byte;  
  I : LongInt;  
  For I:=1 to 20 do