comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Using controlled types to trace program execution
Date: Wed, 6 Mar 2002 10:20:51 -0500
Date: 2002-03-06T10:20:51-05:00	[thread overview]
Message-ID: <u8cck9q2rqrvbc@corp.supernews.com> (raw)
In-Reply-To: 3C7B9007.FB5F257D@uk.thalesgroup.com


"Nige" <nigel.scott@uk.thalesgroup.com> wrote in message
news:3C7B9007.FB5F257D@uk.thalesgroup.com...
> procedure Something is
>
>   Here : Trace.Location ("Something");
>
> begin
>   null;
> end Something;

Try this:

with Ada.Finalization;
package Trace is

   type Location (S : access String) is limited private;

private

   type Location (S : access String) is
      new Ada.Finalization.Limited_Controlled with null record;

   procedure Initialize (L : in out Location);
   procedure Finalize (L : in out Location);

end Trace;


with Trace;
procedure Op is
   S : aliased String := "Op";
   Here : Trace.Location (S'Access);
begin
   null;
end;


You have to declare the string object as aliased.  You don't need heap for
what you're trying to do.






  parent reply	other threads:[~2002-03-06 15:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-26 13:39 Using controlled types to trace program execution Nige
2002-02-26 18:26 ` tmoran
2002-02-27 11:44   ` Nige
2002-03-06 15:20 ` Matthew Heaney [this message]
2002-03-07  8:56   ` Nige
2002-03-07 16:43     ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2002-02-27 11:55 Christoph Grein
2002-02-27 17:59 ` Jeffrey Carter
2002-02-28 15:24   ` Nige
replies disabled

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