Packed

From Lazarus wiki
Revision as of 14:37, 30 October 2017 by Mai (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) русский (ru)

The reserved word packed tells the compiler to use as little memory as possible for a particular complex data type. Without specifying packed, the compiler may insert extra unused bytes between members in order to align the data on full word boundaries for faster access by the CPU. So packed sacrifices some speed while reducing the memory used.


Example:

  type TPArray = Packed array[1 .. 9] of longint ;
  type TPClass = Packed class  ... end;
  type TPObject = Packed object ... end;
  type TPRecord = Packed record ... end;