From: Simon Wright <simon@pushface.org>
Subject: Re: Calling through function pointer--syntax question
Date: 09 Jun 2001 07:29:51 +0100
Date: 2001-06-09T06:29:51+00:00 [thread overview]
Message-ID: <x7vwv6mjhcw.fsf@smaug.pushface.org> (raw)
In-Reply-To: b4682ab7.0106081334.2f14ea61@posting.google.com
adam@irvine.com (Adam Beneschan) writes:
> type func_ptr is access function (param : integer) return integer;
> function func (y : integer := 4) return func_ptr;
> procedure P (x : in integer);
> procedure P (x : in func_ptr);
>
> and my question is about the procedure call:
>
> P (func (5));
This has to be the second P. If you were meaning to call the first P,
you would write
P (func.all (5));
with Ada.Text_Io; use Ada.Text_Io;
Procedure Q is
type Func_Ptr is access function (Param : Integer) return Integer;
function Actual (Param : Integer) return Integer is
begin
return 0;
end Actual;
function Func (Y : Integer := 4) return Func_Ptr is
begin
return Actual'Access;
end Func;
procedure P (X : in Integer) is
begin
Put_Line ("first interpretation");
end P;
procedure P (X : in Func_Ptr) is
begin
Put_Line ("second interpretation");
end P;
begin
P (Func (5));
P (Func.all (5));
end Q;
results in
second interpretation
first interpretation
(GNAT 3.14a)
next prev parent reply other threads:[~2001-06-09 6:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-05 17:43 Calling through function pointer--syntax question adam
2001-06-05 19:39 ` tmoran
2001-06-06 16:17 ` Adam Beneschan
2001-06-06 16:00 ` Tucker Taft
2001-06-06 22:06 ` Adam Beneschan
2001-06-07 1:22 ` Jeffrey Carter
2001-06-08 21:34 ` Adam Beneschan
2001-06-09 6:29 ` Simon Wright [this message]
2001-06-11 13:08 ` Philip Anderson
2001-06-11 17:34 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox