HP Pascal/iX Programmer's Guide (31502-90023)
5-: 21
Packed Record Elements of Enumeration or Subrange Types
If the variable belongs to a packed record, the HP Pascal packing
algorithm allocates it as many bits as it requires, and bit-aligns it.
Example
TYPE
day = (sun,mon,tues,wed,thurs,fri,sat);
VAR
r : PACKED RECORD
f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11 : day;
END;
Each field of the record
r
requires three bits. The entire record
occupies 33 bits. It is allocated five bytes:
NOTE Subranges can cross 4-byte boundaries, but code is less efficient
when they do.
Packed records (such as those above) are byte-aligned. Code is
more efficient when their alignment is specified with the ALIGNMENT
compiler option.
Files
When your program declares a file, the compiler allocates space for the
file control block and the file buffer variable. The amount of space
allocated to each is fixed by the packing algorithm. The file is
8-byte-aligned.
Table 5-9 shows how the HP Pascal packing algorithm allocates file
components for textfiles and nontextfiles.