From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,68536605ede13a20 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.73.229 with SMTP id o5mr10767420pbv.7.1324646412865; Fri, 23 Dec 2011 05:20:12 -0800 (PST) Path: lh20ni55443pbb.0!nntp.google.com!news2.google.com!postnews.google.com!m7g2000vbc.googlegroups.com!not-for-mail From: Simon Belmont Newsgroups: comp.lang.ada Subject: Re: GNAT - return by anonymous access Date: Fri, 23 Dec 2011 05:20:12 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <784c67eb-a542-41b0-b23d-fca1234e56b2@n10g2000vbg.googlegroups.com> <95f3b0fc-af24-4ace-afc9-227e8893ea99@n6g2000vbg.googlegroups.com> <91845790-2447-4b2c-a6b5-1a52557c8c17@d10g2000vbk.googlegroups.com> <4f78ef9f-ca8d-43ef-ab71-0f775fbeebd9@z19g2000vbe.googlegroups.com> <6e5ee357-7409-4974-917c-d7236c782d31@h11g2000yqd.googlegroups.com> <8a7d4dc1-69e5-479f-84a3-5c9c7bdd9aae@j10g2000vbe.googlegroups.com> NNTP-Posting-Host: 24.218.138.255 Mime-Version: 1.0 X-Trace: posting.google.com 1324646412 24492 127.0.0.1 (23 Dec 2011 13:20:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 23 Dec 2011 13:20:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m7g2000vbc.googlegroups.com; posting-host=24.218.138.255; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; InfoPath.2),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-12-23T05:20:12-08:00 List-Id: On Dec 22, 7:56=A0pm, "Randy Brukardt" wrote: > > You could use an Ada 2012 accessor (see 4.1.5 in the draft Ada 2012 RM, o= r > 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 d= o > 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