comp.lang.ada
 help / color / mirror / Atom feed
From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Function Pointers
Date: 1998/04/13
Date: 1998-04-13T00:00:00+00:00	[thread overview]
Message-ID: <matthew_heaney-ya023680001304981847450001@news.ni.net> (raw)
In-Reply-To: 353257CC.211B84EE@phaseiv.com


In article <353257CC.211B84EE@phaseiv.com>, "Barry L. Dorough"
<bdorough@phaseiv.com> wrote:

>Is there any way to implement function pointers in Ada?  Below is a
>sample C program using function pointers.  How can I do this in Ada?

[snip]

>double Combine( double p, double q, double (*fcn)(double r, double s) )
>{
>    double a = 10.0 + p;
>    return fcn( a, q );
>}

Declare a named access type, as follows:

package P is

   type Func_Access is access function (R, S : Long_Float) return Long_Float;

   function Combine (P, Q : Long_Float; Func : Func_Access) return Long_Float;

end P;




  reply	other threads:[~1998-04-13  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-13  0:00 Function Pointers Barry L. Dorough
1998-04-13  0:00 ` Matthew Heaney [this message]
1998-04-14  0:00 ` Jerry van Dijk
1998-04-15  0:00   ` Robert Dewar
1998-04-16  0:00     ` Jerry van Dijk
replies disabled

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