13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

These are the rules by which Pascal packs records:o Fields that contain arrays and records (both packed and unpacked)always start and end at even 16-bit word boundaries.o Fields containing all other data types start with the bit immediatelyfollowing the last bit of the previous field and occupy the minimumnumber of bits necessary to hold their value range.o Fields are never packed across word boundaries. For an illustration ofthis restriction see the earlier section "Packed Arrays."o When a packed record has a variant part, the variant part (beginningwith the tag field) starts at the next word boundary and contains thenumber of bits necessary to store the tag field plus the longest variant.o Fields in variant parts, including the tag field, are packed the same wayas in regular parts of records.o The packed record as a whole extends to the word boundary followingthe last bit of its last field (including variant fields, if any).o Records and arrays that are fields of a packed record are notautomatically packed. You must declare them as packed.Declaring packed records to minimize the memory space they require canbe tricky. The order in which fields are listed can be critical, as well as thefield types used. If in doubt as to the result of packing any record type, usethe SIZEOF function described in Chapter 6 to measure its actual memoryrequirement.IA Tradeoff' Packing and unpacking fields in packed records takes asignificant amount of execution time. Thus execution efficiency is atradeoff against memory conservation when using them.Congruent Record TypesTwo record variables must be of congruent types to participate together aswhole entities in any Pascal operation. A record passed to a procedure orfunction must also be of a type congruent with the record type declared inthe procedure or function's parameter list. For more information aboutpassing records to procedures and functions, see Chapter 8.Any two unpacked record variables, excluding variant types, are congruentif and only if for every field in one there is a corresponding field of the sametype at the same position in the other. Such corresponding fields do notneed to have the same identifiers, however.The RECORD TypeIII-57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!