comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: deallocating class wide types
Date: Mon, 12 May 2003 00:12:06 GMT
Date: 2003-05-12T00:12:06+00:00	[thread overview]
Message-ID: <3EBEE6D3.8080302@attbi.com> (raw)
In-Reply-To: 3ebcea42$1_4@news.arrakis.es

alfonso acosta wrote:
> procedure Destroy (Object: in out My_Class_Access) renames Free;
> 
> end My_Class;
> ----------------------------------------------------------------
> 
> I get:
> my_class.adb:7:59: subprogram used in renaming_as_body cannot be intrinsic

The error tells you that since the calling convention for Destroy 
doesn't match the calling convention for Free, you can't use renaming as 
body.  You could either put the renaming in the package spec, or
another solution is to declare Destroy as a "wrapper" subroutine:

procedure Destroy (Object: in out My_Class_Access) is
begin Free(Object); end Destroy;

If you are really worried about the possibility that this will add run 
time overhead, you can put:
    pragma Inline(Destroy);
in the package spec.  It is usually put in the private part, because the 
user of the package doesn't need to know about it.




      parent reply	other threads:[~2003-05-12  0:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10 12:02 deallocating class wide types alfonso acosta
2003-05-10 12:11 ` alfonso acosta
2003-05-10 12:41 ` David C. Hoos
2003-05-12  0:12 ` Robert I. Eachus [this message]
replies disabled

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