comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Belmont <sbelmont700@gmail.com>
Subject: Re: GNAT - return by anonymous access
Date: Fri, 23 Dec 2011 05:20:12 -0800 (PST)
Date: 2011-12-23T05:20:12-08:00	[thread overview]
Message-ID: <bc9926b7-e35b-43a1-adf7-82a936141dd6@m7g2000vbc.googlegroups.com> (raw)
In-Reply-To: jd0jj3$1t9$1@munin.nbi.dk

On Dec 22, 7:56 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
>
> You could use an Ada 2012 accessor (see 4.1.5 in the draft Ada 2012 RM, or
> AI05-0139-2). It seems that was what you were trying to do (since those
> depend on an access discriminant) -- but the key is, don't, under *ANY*
> circumstances, use an allocator for such a type. Initializing the
> discriminant with an existing object is fine. That's what you'd have to do
> in Ada 95, so I don't really understand why you suddenly changed to using an
> allocator in your Ada 2005 code.
>

Thank you for pointing out the 2012 construct; the endgame was
lifetime control, so that's the right tool for the job.  As far as
using the allocator in such a way, that was never the intention, just
a shortcut i used in a test that uncovered the bug about which I
originally posted before things got sidetracked.  However, it's good
to know that using a 'coextension' has such counter-intuitive
operation.  I assumed that it would be functionally equivilent to
simply declaring the object previously and initializing it with the
exiting object, and certainly not different to the extent of, if I
understand you correctly, not even using the heap at all.

Thank you again for pointing me in the right direction

-sb



  reply	other threads:[~2011-12-23 13:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17 19:17 GNAT - return by anonymous access Simon Belmont
2011-12-17 19:51 ` Simon Wright
2011-12-18  9:08 ` Georg Bauhaus
2011-12-19 23:46 ` Randy Brukardt
2011-12-20  0:14   ` Shark8
2011-12-20 23:18     ` Randy Brukardt
2011-12-21  0:44       ` Simon Belmont
2011-12-21  7:29         ` AdaMagica
2011-12-21 11:05           ` Georg Bauhaus
2011-12-21 11:43             ` AdaMagica
2011-12-21 12:05               ` Georg Bauhaus
2011-12-22  0:33                 ` Randy Brukardt
2011-12-22  0:33           ` Simon Belmont
2011-12-22  7:11             ` Adam Beneschan
2011-12-22 22:11               ` Simon Belmont
2011-12-23  0:56                 ` Randy Brukardt
2011-12-23 13:20                   ` Simon Belmont [this message]
2011-12-27 23:51                     ` Randy Brukardt
2011-12-20 23:53 ` anon
replies disabled

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