HP Pascal/iX Reference Manual (31502-90022)

3- 25
ptr1 = ^rec1;
ptr2 = ^rec2;
rec1 = RECORD
f1, f2: integer;
link: ptr2;
END;
rec2 = RECORD
f1, f2: real;
link: ptr1;
END;
Type Compatibility
Relative to each other, two HP Pascal types can be
identical
,
type
compatible
, or
incompatible
. The guidelines that determine type
compatibility are listed below.
Identical Types
Two types are identical if either of the following is true:
* Their types have the same type identifier.
* If A and B are two type identifiers, and they were made equivalent
by a definition of the form:
TYPE A = B
Compatible Types
Two types, T1 and T2, are type compatible if any of the following is
true:.
* T1 and T2 are identical types.
* T1 and T2 are subranges of identical base types, T1 is a subrange
of T2, or T2 is a subrange of T1.
* T1 and T2 are set types with compatible base types and both T1 and
T2 or neither are packed or crunched.
* T1 and T2 are PAC types.
* T1 and T2 are both string types.
* T1 and T2 are both real types.
Incompatible Types
Two types are
incompatible
if they are
not identical
or
type compatible,
or
assignment compatible
. In the following example all of the variables
are type compatible, but v4, v5, and v6 have identical types. The
variables v2 and v3 also have identical types.
Example
TYPE
interval = 0..10;
range = interval;
VAR
v1 : 0..10;
v2, v3: 0..10;
v4 : interval;
v5 : interval;
v6 : range;
Note that two types that are structurally the same are not necessarily