comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Procedure Overloading
Date: Fri, 25 Jul 2003 09:57:23 +0200
Date: 2003-07-25T09:57:23+02:00	[thread overview]
Message-ID: <aco1ivcv3tb7tjpsr7cnhhvln3r4l0cgrn@4ax.com> (raw)
In-Reply-To: HIJr6x.CFK@news.boeing.com

On Thu, 24 Jul 2003 20:49:45 GMT, "Justin Schaub" <none> wrote:

>Is there a way to specify which overloaded procedure is called in the
>following example?
>
>package A
>
>type Access_Integer is access Integer;
>
>procedure compute( Num : access Integer);
>procedure compute(Num : Access_Integer);
>
>end A;
>
>procedure Test is
>   B : Access_Integer;
>begin
>   compute(B);
>end Test;
>
>The GNAT compiler allows compilation of the package A, but when compiling
>the procedure B it says that there is an ambiguous reference to the
>overloaded compute function.
>
>I have heard that you could simply do
>
>compute (Access_Integer'(B));
>
>but that didn't work either.  Any ideas?  I know it's a silly example but we
>are importing the ADA GLU bindings that have a similar issue.

Passing integers by pointers plus clashed types is indeed silly.

You can rename compute:

procedure Test is
   procedure compute_with_anonymous (Num : access Integer)
      renames A.compute;
   procedure compute_with_named (Num : Access_Integer)
      renames A.compute;

   B : Access_Integer;
begin
   compute_with_named (B);
end Test;

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-07-25  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-24 20:49 Procedure Overloading Justin Schaub
2003-07-25  7:57 ` Dmitry A. Kazakov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-25  5:57 christoph.grein
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox