comp.lang.ada
 help / color / mirror / Atom feed
From: randhol+abuse@pvv.org (Preben Randhol)
Subject: Re: Question about Finalization Control and reference counting
Date: Wed, 25 Apr 2001 15:58:33 +0000 (UTC)
Date: 2001-04-25T15:58:33+00:00	[thread overview]
Message-ID: <slrn9edt40.9fn.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: 3AE5A5B5.4337CE90@boeing.com

On Tue, 24 Apr 2001 16:11:33 GMT, Jeffrey Carter wrote:
> Adjust only applies to a controlled type, so you need to put your access
> value inside a controlled type:
> 
> type Node;
> 
> type Node_Ptr is access all Node;
> 
> type Node is new [Limited_]Controlled with record
>    Prev  : Node_Ptr;
>    Data  : Whatever;
>    Count : Natural := 0;
>    Next  : Node_Ptr;
> end record;
> 
> procedure Adjust (Object : in out Node);
> 
> procedure Finalize (Object : in out Node);


But the problem is that if you have :

   Node1 : Node_Ptr;
   Node2 : Node_Ptr;
   Node3 : Node;

   ...

   After making the Nodes with new you:

   Node1.Next := Node2;

   Then Adjust of Node2 won't be called it will only be called if you
   do:

   Node3 := Node1.all;

   if I understand things correctly. I think I need to rethink my
   problem in a more Ada approach :-)


-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 �For me, Ada95 puts back the joy in programming.�



  reply	other threads:[~2001-04-25 15:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-21 12:37 Question about Finalization Control and reference counting Preben Randhol
2001-04-21 12:44 ` Preben Randhol
2001-04-24 16:11   ` Jeffrey Carter
2001-04-25 15:58     ` Preben Randhol [this message]
2001-04-25 16:01       ` Preben Randhol
2001-04-25 22:22       ` Jeffrey Carter
2001-04-26  8:50         ` Preben Randhol
2001-04-25 16:57     ` Stanley R. Allen
2001-04-24 16:10 ` Alexander Boucke
2001-04-25  3:14 ` DuckE
  -- strict thread matches above, loose matches on Subject: below --
2001-04-25 11:08 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