From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bf0a6e5321bcc595,start X-Google-Attributes: gid103376,public From: "Boaz" Subject: passing pointer of different type to one procedure Date: 1997/04/16 Message-ID: <01bc4a80$713ca380$52bd0c26@cat>#1/1 X-Deja-AN: 235239202 Organization: Cat'Soft Newsgroups: comp.lang.ada Date: 1997-04-16T00:00:00+00:00 List-Id: Hi there, I am trying to write a sort procedure for a data base project. I have 2 different records. Instead of having 2 instances for that sort procedure, I am thinking to use just one that take a pointer of either one of the records type. this is my test program but I don't quite sure how to set it up : with text_io; use text_io; with ada.float_text_io; use ada.float_text_io; procedure test is type record_pointer is access all record; <-- error type a is record key : float; d : integer; end record; type b is record key : float; e : float; end record; rp : record_pointer; d1 : aliased a; d2 : aliased b; procedure sort(p : in record_pointer) is begin put(p.key); end sort; begin d1.key := 1.0; d2.key := 5.0; rp := d1'access; sort(rp); rp := d2'access; sort(rp); end test;