comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Q: Pointers to procedures/functions
Date: 1997/04/11
Date: 1997-04-11T00:00:00+00:00	[thread overview]
Message-ID: <JSA.97Apr11140450@alexandria> (raw)
In-Reply-To: 1997Apr11.143821.5866@news


In article <1997Apr11.143821.5866@news> Gautier.DeMontmollin@maths.unine.ch (Gautier) writes:

> Is there a way to have pointers to procedures in Ada ?
> 
> I wish to use e.g. functions float -> float as parameters for a graph
> procedure.
> 
> G.

In Ada95, no problem.  Here's a snip from the Rationale:

  "type Trig_Function is access function(F: Float) return Float;

   T: Trig_Function;
   X, Theta: Float;

and T can then "point to" functions such as Sin, Cos and Tan. We can
then assign an appropriate access-to-subprogram value to T by for
example

   T := Sin'Access;"

If you are stuck with Ada(83), the vendor for your compiler has
probably supplied an implementation dependent way to do this.

/Jon

-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com





  reply	other threads:[~1997-04-11  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-11  0:00 Q: Pointers to procedures/functions Gautier
1997-04-11  0:00 ` Jon S Anthony [this message]
1997-04-13  0:00   ` Nick Roberts
1997-04-12  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