comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Weird controlled behavior - Gnat 3.15p NT
Date: Thu, 04 Sep 2003 17:40:14 +0200
Date: 2003-09-04T17:40:14+02:00	[thread overview]
Message-ID: <40875687.0LorXooTe4@linux1.krischik.com> (raw)
In-Reply-To: 5d6fdb61.0309040725.3403aa29@posting.google.com

Jano wrote:

> Hello,
> 
> see the following type declarations and lines of code:
> 
>    type Object is abstract new
>       Finalization.Controlled with null record;
>    type Object_access is access all Object'Class;
> 
>    procedure Initialize (This : in out Object) is
>    begin
>       Trace.Log ("====>");
>    end Initialize;

Try to add:

procedure Adjust (This : in out Object) is
   begin
     Trace.Log ("<===>");
   end Adjust;

and Test again.

>    procedure Finalize   (This : in out Object) is
>    begin
>       Trace.Log ("<====");
>    end Finalize;
> 
>    declare
>       -- THIS LINE IS THE RELEVANT ONE.
>       Thing : Object_access :=
>          new Object'Class'(Object'Class'Input (Stream));
>    begin
>       null;
>    end;
> 
> Ok, running normally or stepping with GVD when the line with the
> stream reading is executed I get the following log:
> 
> ====>
> <====
> <====
> <====
> 
> Compiled with -O2 and without it if that means something. Consistently
> with each object in the stream.
> 
> Now, I would assume that no Finalization could happen without a
> corresponding Initialization, so is this normal? Is something wrong in
> that read way?

Yes, types may be Adjusted without Initialization. Has been (and still is) 
a major headache in the design of AdaCL.Trace
(http://adacl.sourceforge.net/html/______Include__AdaCL-Trace__adb.htm).

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




  reply	other threads:[~2003-09-04 15:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-04 15:25 Weird controlled behavior - Gnat 3.15p NT Jano
2003-09-04 15:40 ` Martin Krischik [this message]
2003-09-04 18:06 ` Patrice Freydiere
2003-09-04 19:03   ` Jano
2003-09-04 20:57     ` Jano
2003-09-05  8:48     ` Preben Randhol
2003-09-05 13:48       ` Jano
2003-09-04 21:36 ` Robert I. Eachus
2003-09-05  4:04   ` Randy Brukardt
2003-09-05 13:48     ` Jano
2003-09-05 14:33       ` Dmitry A. Kazakov
2003-09-09  2:01   ` Hyman Rosen
2003-09-09  7:02     ` Jean-Pierre Rosen
2003-09-11  3:40       ` Hyman Rosen
2003-09-09  8:22     ` Dmitry A. Kazakov
2003-09-11  3:46       ` Hyman Rosen
2003-09-11  8:23         ` Dmitry A. Kazakov
2003-09-05  7:10 ` Jean-Pierre Rosen
replies disabled

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