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