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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f9c4ba3b0dc13ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-13 10:14:48 PST Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!agate!blanket.mitre.org!linus.mitre.org!linus!mbunix!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: Addressing functions Date: 13 Dec 94 10:14:48 Organization: The Mitre Corp., Bedford, MA. Message-ID: References: <3citrc$bb5@earth.usa.net> NNTP-Posting-Host: spectre.mitre.org In-reply-to: wbuckley@earth's message of 13 Dec 1994 01:36:44 GMT Date: 1994-12-13T10:14:48+00:00 List-Id: In article <3citrc$bb5@earth.usa.net> wbuckley@earth (Bill Buckley) writes: > For instance if I were to have an array of subprogram addresses > A(1..2) => (1 => Print1'ADDRESS, > 2 => Print2'ADDRESS); > how could I implement the calling these functions...I have heard > from several other Ada programmers that this may not be possible. First, calling any subprogram given its address is, in Ada, implementation specific, and you should check with the Appendix F for the compiler you use to find out what restrictions, if any, are imposed. Typical restrictions are that the subprogram may not require an enivironment to be passed to it, or that the calling conventions expected match. Having said that, it is legal Ada (83 & 95) to say: declare procedure Foo; pragma INTERFACE(Ada, Foo); for Foo use at A(n); -- obsolescent but supported in Ada 9X, preferred is: -- for Foo'ADDRESS use A(n); begin Foo; end; Of course, any such program is erroneous if the profile of the procedure located at A(n) does not match that of Foo. Note that the address in an address clause is not required or expected to be static. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...