From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,f196003f7b36852b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-24 03:19:41 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.158.233.21!news1.ebone.net!news.ebone.net!newsfeeds.net.uni-c.dk!uninett.no!ntnu.no!randhol+abuse From: randhol+abuse@pvv.org (Preben Randhol) Newsgroups: comp.lang.ada Subject: Question about Finalization Control and reference counting Date: Sat, 21 Apr 2001 12:37:26 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: NNTP-Posting-Host: kiuk0156.chembio.ntnu.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: tyfon.itea.ntnu.no 987856646 25477 129.241.83.82 (21 Apr 2001 12:37:26 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Sat, 21 Apr 2001 12:37:26 +0000 (UTC) User-Agent: slrn/0.9.6.3 (Linux) Xref: newsfeed.google.com comp.lang.ada:6882 Date: 2001-04-21T12:37:26+00:00 List-Id: Hi I'm wondering if it is possible to do something like this type Data_Type is new Ada.Finalization.Controlled with record References: Integer := 0; end record; type Data_Access_Type is access Data_Type; [..] and then in the main program if I do something like this: procedure main is Pointer : Data_Access_Type := null; Data : Data_Access_Type := new Data_Type; begin Pointer := Data; end main; to have Data.References increases by using Adjust? I'm trying but it looks like it only works if I do: Pointer : Data_Type; ... Pointer := Data.all; ... otherwise Adjust is not invoked. Is it possible to get it invoked if one point an access type to an object? I'm trying to eliminate the problem of dangling pointers in a program... Thanks in advance. -- Preben Randhol ------------------- http://www.pvv.org/~randhol/ -- �For me, Ada95 puts back the joy in programming.�