From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: Function pointer in Ada?
Date: Tue, 14 May 2002 09:12:36 -0400
Date: 2002-05-14T13:12:37+00:00 [thread overview]
Message-ID: <abr2g5$rha$1@nh.pace.co.uk> (raw)
In-Reply-To: 5f4adaeaa2a7b35810acd4e20fb98b25.86200@mygate.mailgate.org
Yes Ada (at least Ada95) can create pointers to functions. (General advice:
Think long and hard about why you want to use access to functions and ask
yourself if there is a more Ada-ish way to do the same thing - like using
tagged types with dispatching) Look at ARM 3.10 for the syntax, etc. An
example can be found in ARM 3.10(26) which for your convenience is:
26 type Message_Procedure is access procedure (M : in String := "Error!");
procedure Default_Message_Procedure(M : in String);
Give_Message : Message_Procedure := Default_Message_Procedure'Access;
...
procedure Other_Procedure(M : in String);
...
Give_Message := Other_Procedure'Access;
...
Give_Message("File not found."); -- call with parameter (.all is optional)
Give_Message.all; -- call with no parameters
MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas www.pacemicro.com
Enabling the digital revolution
e-Mail: marin.condic@pacemicro.com
"Henrik Quintel" <henrik.quintel@gmx.de> wrote in message
news:5f4adaeaa2a7b35810acd4e20fb98b25.86200@mygate.mailgate.org...
> Hi, as the most people know, in C there is the possibility to make use
> of a function pointer. In Ada this not possible. Does someone knows how
> is it possible to make use of such a feature like a function pointer in
> Ada? I know it is difficult but perhaps someone knows.
>
next prev parent reply other threads:[~2002-05-14 13:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-14 12:51 Function pointer in Ada? Henrik Quintel
2002-05-14 13:08 ` Markus Knauss
2002-05-14 13:12 ` Marin David Condic [this message]
2002-05-14 14:36 ` Alfred Hilscher
2002-05-14 17:58 ` Kai Schuelke
2002-05-14 18:01 ` Preben Randhol
2002-05-14 18:24 ` David C. Hoos
2002-05-14 20:00 ` Kai Schuelke
2002-05-14 18:25 ` Marin David Condic
2002-05-15 22:30 ` Kai Schuelke
2002-05-16 11:37 ` Marc A. Criley
2002-05-16 19:06 ` Kai Schuelke
2002-05-16 19:18 ` Preben Randhol
2002-05-16 12:53 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox