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: 103376,f8a440310f7f2e02 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!p25g2000hsf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Extended return question Date: Thu, 10 Jul 2008 08:24:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: <087fa4ee-2630-48bd-af32-db5fae83ec68@p25g2000hsf.googlegroups.com> References: <4875b7e3$0$6618$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1215703485 16548 127.0.0.1 (10 Jul 2008 15:24:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 10 Jul 2008 15:24:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p25g2000hsf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1085 Date: 2008-07-10T08:24:45-07:00 List-Id: On Jul 10, 12:32 am, Dale Stanbrough wrote: > Georg Bauhaus wrote: > > Dale Stanbrough wrote: > > > The purpose of an extended return is to create the values in-situ > > > without copying. > > > _Limited_ objects can be initialized in situ by an aggregate > > or function call ... :-) > > Ah, thanks. I had misread John Barnes comments on this. Why such a > restriction? Why not allow it for all extended returns on all types? For nonlimited types, function calls work the same way they've always worked since Ada 83. The function call builds an anonymous object. In your example, since you're using an assignment, the anonymous object is then assigned into Destination. But of course, if the function raises an exception, the assignment never takes place. This isn't too different from this situation, which has always existed since Ada 83: Destination := (1 => Func1, 2 => Func2, 3 => Func3, 4 => Func4); If Func1 and Func2 complete normally, but Func3 raises an exception, *no* elements of Destination are changed. Extended return is no different. Function calls still involve anonymous objects to hold the function result, and extended return doesn't change that. Hope this helps, -- Adam