comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: Freeing Pointers to classwide types
Date: 1998/09/26
Date: 1998-09-26T00:00:00+00:00	[thread overview]
Message-ID: <360c4a70.29707515@SantaClara01.news.InterNex.Net> (raw)
In-Reply-To: 6ugeu2$79u$1@nnrp1.dejanews.com

>> to free the memory pointed to by 'p' when it leaves procedure
>> something.

>Tom, there is absolutely no reason to "hope" this, since it is certainly
>not required semantics

with Ada.Finalization;
package Test1 is
  type T is new Ada.Finalization.Controlled with null record;
  procedure Initialize(X : in out T);
  procedure Finalize(X : in out T);
end Test1;

with Ada.Text_IO;
package body Test1 is
  procedure Initialize(X : in out T) is
  begin
    Ada.Text_IO.Put_Line("Initialize");
  end Initialize;
  procedure Finalize(X : in out T) is
  begin
    Ada.Text_IO.Put_Line("Finalize");
  end Finalize;
end Test1;

with Test1,
     Ada.Text_IO;
procedure Test is
  procedure Something is
    type Ptr is access Test1.T;
    P : Ptr;
  begin
    Ada.Text_IO.Put_Line("start Something");
    P := new Test1.T;
    Ada.Text_IO.Put_Line("end Something");
  end Something;
begin
  Ada.Text_IO.Put_Line("Start");
  Something;
  Ada.Text_IO.Put_Line("End");
end Test;
                    The three compilers I tried all produce:
Start
start Something
Initialize
end Something
Finalize
End
     Do you mean that it would be legal Ada to produce a different
output, or that it should produce this  but might not actually free
the memory after the Finalize?





  parent reply	other threads:[~1998-09-26  0:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-24  0:00 Freeing Pointers to classwide types joecool
1998-09-25  0:00 ` alan walkington
1998-09-25  0:00 ` Tom Moran
1998-09-25  0:00   ` dewarr
1998-09-25  0:00     ` Tom Moran
1998-09-25  0:00       ` dewarr
1998-09-26  0:00     ` Tom Moran [this message]
1998-09-26  0:00       ` dewarr
1998-09-26  0:00         ` Tom Moran
1998-09-27  0:00           ` dewarr
1998-09-27  0:00             ` Tom Moran
1998-09-28  0:00               ` dewarr
1998-09-28  0:00                 ` Tom Moran
1998-09-28  0:00                   ` dewarr
1998-09-28  0:00                     ` Richard D Riehle
1998-09-28  0:00                       ` Pat Rogers
1998-09-29  0:00                       ` dewarr
1998-09-28  0:00                   ` dewarr
1998-09-28  0:00                     ` Tom Moran
1998-09-28  0:00                       ` Pat Rogers
1998-09-28  0:00                         ` Tom Moran
1998-09-28  0:00                           ` Pat Rogers
1998-09-29  0:00                           ` dewarr
1998-09-29  0:00                             ` Tom Moran
1998-09-30  0:00                               ` Tom Moran
1998-10-01  0:00                                 ` dewar
1998-10-01  0:00                                   ` Tom Moran
1998-10-01  0:00                                     ` Samuel Tardieu
1998-10-01  0:00                                       ` Tom Moran
1998-10-01  0:00                                         ` dennison
1998-10-01  0:00                                         ` Tucker Taft
1998-10-01  0:00                                           ` Tom Moran
1998-10-02  0:00                                           ` dennison
1998-10-02  0:00                                             ` dewarr
1998-10-02  0:00                                           ` dewarr
1998-10-02  0:00                                             ` Larry Kilgallen
1998-10-02  0:00                                               ` dewarr
1998-10-02  0:00                                         ` dewarr
1998-10-09  0:00                                           ` Matthew Heaney
1998-10-09  0:00                                             ` dennison
1998-10-09  0:00                                               ` Matthew Heaney
1998-10-01  0:00                                     ` dewarr
1998-10-01  0:00                                       ` Tom Moran
1998-10-01  0:00                                     ` dewarr
1998-09-28  0:00                       ` Tom Moran
1998-09-28  0:00                         ` Brian Rogoff
1998-10-09  0:00           ` Matthew Heaney
1998-09-25  0:00   ` Bob Fletcher
1998-09-25  0:00     ` dennison
1998-09-25  0:00     ` Samuel Tardieu
1998-10-09  0:00     ` Matthew Heaney
1998-10-12  0:00       ` Mats Weber
1998-10-12  0:00         ` Pat Rogers
1998-10-09  0:00   ` Matthew Heaney
1998-09-26  0:00 ` Simon Wright
1998-10-09  0:00 ` Matthew Heaney
1998-10-09  0:00   ` Niklas Holsti
1998-10-10  0:00     ` Matthew Heaney
1998-10-11  0:00       ` Niklas Holsti
1998-10-11  0:00         ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
1998-09-25  0:00 bpr5549
replies disabled

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