[top] [prev] [next]

Packed types

A declaration of a packed type has the form:

    TYPE T = BITS n FOR Base
where Base is a type and n is an integer-valued constant expression. The values of type T are the same as the values of type Base, but variables of type T that occur in records, objects, or arrays will occupy exactly n bits and be packed adjacent to the preceding field or element. For example, a variable of type
    ARRAY [0..255] OF BITS 1 FOR BOOLEAN
is an array of 256 booleans, each of which occupies one bit of storage.

The values allowed for n are implementation-dependent. An illegal value for n is a static error. The legality of a packed type can depend on its context; for example, an implementation could prohibit packed integers from spanning word boundaries.

[top] [prev] [next]