Packed/de: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Packed/de
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Zurück zu den [[Reserved words/de|reservierten Wörtern]]. | |
| 2 | + | ||
| 3 | + | Das reservierte Wort <b>packed</b> weist den Compiler an, für das Objekt sowenig Speicher wie möglich zu verwenden. | |
| 4 | + | ||
| 5 | + | Das wird dadurch erreicht, das zwischen einzelnen Elementen kein Zwischenraum gelassen wird. | |
| 6 | + | ||
| 7 | + | D. h. die einzelnen Elemente werden auch an ungeraden Speicheradressen ausgerichtet. | |
| 8 | + | ||
| 9 | + | Beispiel: | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | type TPArray = Packed array[...] of ...; | |
| 13 | + | type TPClass = Packed class ... end; | |
| 14 | + | type TPObject = Packed object ... end; | |
| 15 | + | type TPRecord = Packed record ... end; | |
| 16 | + | ``` | |
| 17 | + | ||
| 18 | + | Es ist auch bitweises Packen möglich, dies geschieht mit [[bitpacked]]. | |
| 19 | + | ||
| 20 | + | Das Array **a0** ist ein Byte groß. | |
| 21 | + | ||
| 22 | + | Das normal deklarierte **a1** aber 8 Byte. | |
| 23 | + | ||
| 24 | + | ``` pascal | |
| 25 | + | var | |
| 26 | + | a0: bitpacked array[0..7] of Boolean; // 1 Byte | |
| 27 | + | a1: array[0..7] of Boolean; // 8 Byte | |
| 28 | + | ``` | |
| 29 | + | ||
| 30 | + | --- | |
| 31 | + | *From 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](/wiki-contact).* |
