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:19:41 -0700 (PDT)
Date: 2008-07-10T08:19:41-07:00	[thread overview]
Message-ID: <69940bd4-74f7-4b00-93d6-482c7394fcef@34g2000hsf.googlegroups.com> (raw)
In-Reply-To: wccfxqh24ak.fsf@shell01.TheWorld.com

On Jul 10, 7:37 am, Robert A Duff <bobd...@shell01.TheWorld.com>
wrote:
> Dale Stanbrough <MrNoS...@bigpoop.net.au> writes:
> > The purpose of an extended return is to create the values in-situ
> > without copying.
>
> No, that's not correct.  Limited function results are built in place,
> nonlimited ones are not.  It's got nothing to do with which sort of
> return statement you use -- limited builds in place even when you
> say "return <expression>;".

Actually, the situation with limited types isn't totally clear,
either.  However, for limited types, there's no way Dale could test
this using the sort of example he used above, since he used his
Extended_Return_Function on the right-hand side of an assignment,
which wouldn't be allowed for a function returning a limited type.  If
he tried to use the function call as an initializer for some object X,
and the function raised an exception and left, there's no way X could
be examined to determine whether some of the components of X were set.

But in AI05-67, I did come up with an example where an extended return
with a limited function result was left with a GOTO, and the function
then did another extended return, and I had a question about whether
the components set up by the first extended return (if not overwritten
by the second) were required to show up in the result.  Your answer,
Bob, was "no", and I think that if AI05-67 is adopted, the answer will
still be "no", because this AI says that the function result object
does not "morph" into the created object until the return is
completed.  The upshot of this AI is, I think, that (1) the object
being worked on for an extended return is *not* an "alias" for the
object being created, even for a limited type, and (2) although
limited types aren't supposed to be copied, this is true only in an
Ada semantic sense, and implementations are allowed to do any block-
copies they wish as long as they get the Ada semantics right.

                                 -- Adam




  reply	other threads:[~2008-07-10 15:19 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
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 [this message]
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