comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Addressing functions
Date: 13 Dec 94 10:14:48
Date: 1994-12-13T10:14:48+00:00	[thread overview]
Message-ID: <EACHUS.94Dec13101448@spectre.mitre.org> (raw)
In-Reply-To: wbuckley@earth's message of 13 Dec 1994 01:36:44 GMT

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...



  reply	other threads:[~1994-12-13 10:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-12-13  1:36 Addressing functions Bill Buckley
1994-12-13 10:14 ` Robert I. Eachus [this message]
1994-12-14 13:59   ` Theodore E. Dennison
1994-12-16 14:18   ` Arthur Evans Jr
1994-12-17 17:27     ` Robert Dewar
1994-12-17 17:32     ` Robert Dewar
1994-12-18  6:44       ` Bill Buckley
1994-12-16 16:56   ` Robert Dewar
1994-12-13 19:04 ` Bob Duff
1994-12-14  1:48 ` Michael Feldman
1994-12-16 14:53   ` Robert Dewar
1994-12-17  7:23   ` Addressing functions (long) Michael M. Bishop
1994-12-18  6:53     ` Bill Buckley
1994-12-14 12:33 ` Addressing functions Mitch Gart
1994-12-15 16:26   ` Erich A. Pfeiffer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox