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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,57f8540942f8e060 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!postnews.google.com!t34g2000prm.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Initialization and Finalization of limited object "returned" by a function Date: Thu, 11 Feb 2010 09:40:10 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1265910011 15765 127.0.0.1 (11 Feb 2010 17:40:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 11 Feb 2010 17:40:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t34g2000prm.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9114 Date: 2010-02-11T09:40:10-08:00 List-Id: On Feb 11, 7:16=A0am, Robert A Duff wrote: > "Hibou57 (Yannick Duch=EAne)" writes: > > > What a surprise to me to experience something different : limited > > object Finalized right after Initialization. > > I'm not going to read your code carefully, but that doesn't > seem right. =A0If you have: > > =A0 =A0 X : T :=3D F(...); > > the result of F is "built in place" in X, and should be finalized > when the procedure containing X is left. Yes, I believe that's right, and it's spelled out clearly in the RM, in sections 7.6(17.1/3-17.11/3 and especially 17.7/3), 6.5(5.8/3), 6.5(23/2), 7.6(4), and 3.10.2(10.1/2). P.S. That was intended as sarcasm. I think these references are right, but some of them contain some of the nastiest language in the RM. If Yannick really wants to re-check the RM, as he mentioned, I recommend having a bottle of Tylenol handy. Or a few beers. But more simply, as I understand it: (1) When you have an extended return, the return object is used as the anonymous object that holds the function result at the point of the function call, so it's not finalized until the caller is done with the anonymous object; and (2) when the object is built in place, the anonymous object "mutates into" the new object and is not finalized (7.6(17.7/3)). So yes, no finalization should be done until X goes out of scope. -- Adam