Packed/de
Zurück zu den reservierten Wörtern.
Das reservierte Wort packed weist den Compiler an, für das Objekt sowenig Speicher wie möglich zu verwenden.
Das wird dadurch erreicht, das zwischen einzelnen Elementen kein Zwischenraum gelassen wird.
D. h. die einzelnen Elemente werden auch an ungeraden Speicheradressen ausgerichtet.
Beispiel:
type TPArray = Packed array[...] of ...;
type TPClass = Packed class ... end;
type TPObject = Packed object ... end;
type TPRecord = Packed record ... end;Es ist auch bitweises Packen möglich, dies geschieht mit bitpacked.
Das Array a0 ist ein Byte groß.
Das normal deklarierte a1 aber 8 Byte.
var
a0: bitpacked array[0..7] of Boolean; // 1 Byte
a1: array[0..7] of Boolean; // 8 ByteFrom the Free Pascal wiki, page "Packed/de", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
