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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8e7e976ead4a812 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-15 12:14:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newspeer.clara.net!news.clara.net!psiuk-p2!psiuk-p3!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Function pointer in Ada? Date: Tue, 14 May 2002 09:12:36 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <5f4adaeaa2a7b35810acd4e20fb98b25.86200@mygate.mailgate.org> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1021381957 28202 136.170.200.133 (14 May 2002 13:12:37 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 14 May 2002 13:12:37 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:24117 Date: 2002-05-14T13:12:37+00:00 List-Id: 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" 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. >