Difference between revisions of "Packed"

From Lazarus wiki
Jump to navigationJump to search
(initial page)
 
m (FPC user moved page Packed/en to Packed: drop en suffix)
(No difference)

Revision as of 04:00, 22 August 2017

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[...] of ...;
  type TPClass = Packed class  ... end;
  type TPObject = Packed object ... end;
  type TPRecord = Packed record ... end;