comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Extended return question
Date: Thu, 10 Jul 2008 08:24:45 -0700 (PDT)
Date: 2008-07-10T08:24:45-07:00	[thread overview]
Message-ID: <087fa4ee-2630-48bd-af32-db5fae83ec68@p25g2000hsf.googlegroups.com> (raw)
In-Reply-To: MrNoSpam-BCD9C2.17322110072008@news-server.bigpond.net.au

On Jul 10, 12:32 am, Dale Stanbrough <MrNoS...@bigpoop.net.au> 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




  reply	other threads:[~2008-07-10 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10  2:11 Extended return question Dale Stanbrough
2008-07-10  7:18 ` Georg Bauhaus
2008-07-10  7:32   ` Dale Stanbrough
2008-07-10 15:24     ` Adam Beneschan [this message]
2008-07-10 23:56       ` Dale Stanbrough
2008-07-10 23:20     ` Randy Brukardt
2008-07-11  0:03       ` Adam Beneschan
2008-07-11  0:50         ` Robert A Duff
2008-07-10 14:37 ` Robert A Duff
2008-07-10 15:19   ` Adam Beneschan
2008-07-10 18:36     ` Dmitry A. Kazakov
2008-07-11  0:43       ` Robert A Duff
2008-07-11  7:39         ` Dmitry A. Kazakov
2008-07-11  9:06           ` christoph.grein
2008-07-11 14:24             ` Dmitry A. Kazakov
2008-07-11  0:29     ` Robert A Duff
replies disabled

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