comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Question about library-level functions
Date: Sat, 15 Dec 2012 03:38:44 -0800 (PST)
Date: 2012-12-15T03:38:44-08:00	[thread overview]
Message-ID: <1d71f931-42ff-45aa-8ad2-69cae4980917@googlegroups.com> (raw)
In-Reply-To: <565c0f25-e620-4875-9248-2371a874d345@googlegroups.com>

> As a result, lifetime.Finalize was called twice.
> % ./main
> before
> Initialize (0000000100100090)
> Finalize (0000000100100090)
> lifetime
> Finalize (0000000100100090)
> after

 Hm, I'm no lnaguage lawer, but this looks wrong to me.

> > Finalize may not be called in Alloc,  
> Surely, lifetime.Finalize may be called in 'Alloc'.
>
> The backtrace of gdb is:
>
> #0  lifetime__finalize__2 (object=) at lifetime.adb:7
> #1  0x0000000100001a9c in lifetime__tFD () at lifetime.adb:4
> #2  0x000000010000da39 in system__finalization_masters__finalize (master=) at s-finmas.adb:241
> #3  0x00000001000026d8 in _ada_alloc () at alloc.adb:5
> #4  0x00000001000028f2 in _ada_main () at main.adb:11

Don't know what's happening here...

> > since the object must be created in place
> > (it's limited - there cannot be an intermediate object as in the unlimited 
> > case). 
>
> lifetime.T is limited. However, an access value of it is not limited.

Irrelevant, since it's an object of type T that's finalized here at the end of the lifetime of the corresponding access type.

> Perhaps AARM 7.6.1 says the anonymous access type belongs to innermost master.
> The master is usually in the package and lets objects live long time.
> I imagine, if a function is library-level, there is no place which it
> puts the master, so the master is inside of the function...???

Hm, the master of type A is the access block.

But I'm not sure who the master is of the anonymous access type declared with function Alloc. It should be the environment task, just as that is ultimately the master of any library unit (be it a package or a subprogram).

In effect, I do not really understand what is happening here...



  reply	other threads:[~2012-12-15 11:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-15  3:38 Question about library-level functions ytomino
2012-12-15  9:47 ` AdaMagica
2012-12-15 10:50   ` ytomino
2012-12-15 11:38     ` AdaMagica [this message]
2012-12-17 19:49       ` Adam Beneschan
2012-12-18  2:26         ` ytomino
2012-12-15 15:23 ` sbelmont700
2012-12-16  6:09   ` ytomino
2012-12-16  9:43 ` Simon Wright
2012-12-16 10:21   ` AdaMagica
2012-12-16 13:07     ` ytomino
2012-12-16 18:31     ` Simon Wright
2012-12-18  3:18       ` ytomino
2012-12-18  0:07     ` Randy Brukardt
2012-12-16 13:34   ` ytomino
2012-12-16 15:54     ` AdaMagica
2012-12-18  0:09       ` Randy Brukardt
replies disabled

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