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,4b807da453e88972 X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: Function Pointers Date: 1998/04/13 Message-ID: #1/1 X-Deja-AN: 343783213 Content-Transfer-Encoding: 8bit References: <353257CC.211B84EE@phaseiv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Newsgroups: comp.lang.ada Date: 1998-04-13T00:00:00+00:00 List-Id: In article <353257CC.211B84EE@phaseiv.com>, "Barry L. Dorough" 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;