raz / conform / run / Sameness.raz

26 lines · 516 B · raw · history · last change 264716cb

1(* A named type and an anonymous one built alike are the same; of two
2 named types built alike on the right, each is the same as the
3 anonymous one. *)
4module Sameness;
5import Out;
6import SYSTEM;
7
8type
9 Node = record v: I64; end;
10 P1 = ^Node;
11 P2 = ^Node;
12 NodePtr = ^Node;
13
14proc main*;
15var r: Node; p1: P1; p2: P2; n: ^Node; q: NodePtr;
16begin
17 r.v := 7;
18 n := SYSTEM.ADR(r);
19 p1 := n;
20 n := p1;
21 p2 := n;
22 q := SYSTEM.ADR(r);
23 Out.int(p2^.v + q^.v); Out.ln;
24end;
25
26end Sameness.