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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,24c2bbee2aceff98,start X-Google-Attributes: gid103376,public From: adam@irvine.com (Adam Beneschan) Subject: Ada 95 dispatching question Date: 1997/11/26 Message-ID: <880581829.29833@dejanews.com>#1/1 X-Deja-AN: 292980043 X-Http-User-Agent: Mozilla/3.0 (X11; I; Linux 2.0.18 i586) X-Originating-IP-Addr: 192.160.8.44 (dogbert.irvine.com) Organization: Deja News Posting Service X-Authenticated-Sender: adam@irvine.com (Adam Beneschan) X-Article-Creation-Date: Wed Nov 26 22:03:53 1997 GMT Newsgroups: comp.lang.ada Date: 1997-11-26T00:00:00+00:00 List-Id: What should the following program output? I'm trying to get it to output 3/TRUE/"abcdefghij"/ 15 but it outputs instead 3/TRUE/??? when compiled with GNAT 3.01. If the output is correct, then why? In particular, is the line marked "<=== HERE" a dispatching call, and if not, why not? And how would I have to modify the program to get it to do what I'd like it to do, given that declaring do_to_aux and do_to_rec in PACK1 is not an option? (My apologies if the problem is that I made a stupid mistake.) -- thanks, Adam package pack1 is type auxinfotype is tagged null record; type auxinfotype_p is access auxinfotype'class; type rectype is record f1 : integer; f2 : boolean; f3 : auxinfotype_p; end record; end pack1; with pack1; package pack2 is type auxinfotype2 is new pack1.auxinfotype with null record; procedure do_to_aux (a : in auxinfotype2); procedure do_to_rec (r : in pack1.rectype); end pack2; with text_io; package body pack2 is procedure do_to_aux (a : in auxinfotype2) is begin text_io.put ("???"); end do_to_aux; procedure do_to_rec (r : in pack1.rectype) is begin text_io.put (integer'image (r.f1) & "/" & boolean'image (r.f2) & "/"); do_to_aux (auxinfotype2 (r.f3.all)); -- <=== HERE text_io.new_line; end do_to_rec; end pack2; with pack2; package pack3 is type auxinfotype3 is new pack2.auxinfotype2 with record af1 : string (1 .. 10); af2 : integer; end record; procedure do_to_aux (a : in auxinfotype3); end pack3; with text_io; package body pack3 is procedure do_to_aux (a : in auxinfotype3) is begin text_io.put ('"' & a.af1 & """/" & integer'image (a.af2)); end do_to_aux; end pack3; with pack1; with pack2; with pack3; procedure test is a : pack3.auxinfotype3; r : pack1.rectype; begin a.af1 := "abcdefghij"; a.af2 := 15; r.f1 := 3; r.f2 := true; r.f3 := new pack3.auxinfotype3' (a); pack2.do_to_rec (r); end test; -------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet