15 Jun
2020
15 Jun
'20
9:43 p.m.
On 2020-06-15 21:09, chris wrote:
TYPE R = RECORD i : INTEGER END; P1 = POINTER TO R; P2 = POINTER TO R;
PROCEDURE Test(); VAR p1 : P1; p2 : P2; BEGIN NEW(p1); NEW(p2); IF p1 IS P2 THEN (* true *) END; p1 := p2; END Test; [...] I am a bit confused that p1 := p2 compiles without errors. Section 6.4 in the language report says that "Pointer types inherit the extension relation of their base types, if there is any." Also P2 is a (trivial) extension of P1 and vice versa.
August