HP Pascal/iX Reference Manual (31502-90022)

12- 82
CONVERSION Permits value type coercion of ordinal and pointer
types. This is the most useful and transportable form
of type coercion.
STRUCTURAL Permits coercion of any data type to any structurally
compatible data type. (This is equivalent to renaming
components. It is fully transportable.)
REPRESENTATION Permits coercion of any data type to any
representation-size compatible data type.
Representation-size compatible types have identical
BitSizeof
values.
STORAGE Permits any type coercion that does not extend the
amount of storage accessed. The data type being coerced
must have a
Sizeof
value less than or equal to the
Sizeof
value of the data type to which it is being
coerced.
NONCOMPATIBLE Permits coercion of any data item to any data type.
This coercion can be dangerous, and errors cannot be
detected.
Default NONE.
Location Anywhere.
See Chapter 11 for more information on type coercion.
Example
0 1.000 0 $STANDARD_LEVEL 'HP_MODCAL'$
0 2.000 0 PROGRAM show_type_coercion;
0 3.000 0
0 4.000 0 TYPE
0 5.000 0 Rec1 = RECORD
1 6.000 0 F1 : integer;
2 7.000 0 F2 : integer;
3 8.000 0 END;
3 9.000 0 Arr1 = PACKED ARRAY [1..8] OF char;
4 10.000 0
4 11.000 0 VAR
4 12.000 0 R : Rec1;
5 13.000 0 A : Arr1;
6 14.000 0
6 15.000 1 BEGIN
6 16.000 1
6 17.000 1 R.F1 := 101; R.F2 := 280;
8 18.000 1
8 19.000 1 $TYPE_COERCION 'Structural'$
8 20.000 1
8 21.000 1 A := Arr1(R); {illegal, not structurally compatible}
^
**** ERROR # 1 COERCION REQUIRES $TYPE_COERCION 'REPRESENTATION'$ (809)
9 22.000 1
9 23.000 1 $TYPE_COERCION 'Representation'$
9 24.000 1
9 25.000 1 A := Arr1(R);
10 26.000 1
10 27.000 1 END.
UPPERCASE
UPPERCASE is an HP Pascal Option.
When the UPPERCASE compiler option is ON, the compiler upshifts all
external names (names of routines and global variables), including
aliases. When UPPERCASE is OFF, the compiler downshifts these names.