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-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Initialization and Finalization of limited object "returned" by a function Date: Thu, 11 Feb 2010 14:10:39 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1265915429 15958 192.74.137.71 (11 Feb 2010 19:10:29 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 11 Feb 2010 19:10:29 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:7O9mUu1UPNjnG6W3E4+eaUjwUsI= Xref: g2news1.google.com comp.lang.ada:9115 Date: 2010-02-11T14:10:39-05:00 List-Id: Adam Beneschan writes: > 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. Just to be clear: There's nothing particularly special about extended return statements, other than the fact that they provide a name for the result. Build-in-place is caused by being immutably limited, and it works fine for old-fashioned simple return statements. Extended return syntax can be used with both limited and non-limited. - Bob