comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: debugging tool?
Date: 22 Feb 2004 22:54:47 -0500
Date: 2004-02-22T22:54:47-05:00	[thread overview]
Message-ID: <mailman.13.1077508512.327.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <GJc_b.39961$Xp.180044@attbi_s54>

tmoran@acm.org writes:

> So maybe the question becomes:  is it safe to access
> simple things like booleans after they've been finalized/de-elaborated?

That depends on why Finalize got run. If it was in response to a call
to Unchecked_Deallocation, and the memory really was deallocated, then
it is not safe. But then you have a dangling pointer problem, for
which there are tools. 

Hmm. In your example, Helper_Object was declared in a package body,
and Main_Object in the main program. The compiler decided to finalize
objects in the package body before objects in the main program. 

Hmm. ARM 7.6.1 says the objects declared in the main program
should have been finalized before objects declared in packages. So
this looks like a compiler bug.

However, Annotated ARM 7.6.1 11.g says:

          Implementation Note: An implementation has to ensure that the
          storage for an object is not reclaimed when references to the
          object are still possible (unless, of course, the user
          explicitly requests reclamation via an instance of
          Unchecked_Deallocation). This implies, in general, that
          objects cannot be deallocated one by one as they are
          finalized; a subsequent finalization might reference an
          object that has been finalized, and that object had better be
          in its (well-defined) finalized state.

That says it is safe to put a Finalized flag in Helper_Type, as long
as you are not using Unchecked_Deallocation.

-- 
-- Stephe




  reply	other threads:[~2004-02-23  3:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-21  5:56 debugging tool? tmoran
2004-02-22 21:25 ` Hyman Rosen
2004-02-22 22:17   ` tmoran
2004-02-22 23:18     ` Stephen Leake
2004-02-23  1:21       ` tmoran
2004-02-23  1:31         ` tmoran
2004-02-23  3:54           ` Stephen Leake [this message]
2004-02-23  5:43             ` tmoran
2004-02-23  3:34         ` Stephen Leake
replies disabled

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