comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why is the destructor called multiple times after I declare an object?
Date: Wed, 13 Jan 2016 09:31:11 +0100
Date: 2016-01-13T09:31:11+01:00	[thread overview]
Message-ID: <n75214$1ata$1@gioia.aioe.org> (raw)
In-Reply-To: wccbn8qz6r9.fsf@shell01.TheWorld.com

On 13/01/2016 01:02, Robert A Duff wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> On 2016-01-12 21:21, Randy Brukardt wrote:
>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>>> news:n72hag$bjq$1@gioia.aioe.org...
>>>> On 12/01/2016 00:44, Randy Brukardt wrote:
>>>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>>>>> news:n715oq$fae$1@gioia.aioe.org...
>>>>>> On 2016-01-11 19:17, Bob Duff wrote:
>>>>>>> Build-in-place is done for return of immutably-limited types,
>>>>>>> whether or not the extended return syntax is used.
>>>>>>
>>>>>> But you can leave one return statement on an exception, catch the
>>>>>> exception, and then return through another return statement, with other
>>>>>> discriminants and even other type of the result (if it is class-wide).
>
> Yes.  Or you can 'goto' or 'exit' out of an extended return.
>
>>>>>> Therefore the result can be potentially allocated and reallocated any
>>>>>> number of times. In which sense is this behavior 'in-place'?
>
> "In place" means that the returned object created by the return
> statement that actually returns is the same object as the one at the
> call site.

It is rather a useless definition, because it would apply to the objects 
returned by-copy as well. At some point *some* object created as a 
result of a call to the callee becomes the object of the caller.

To my understanding Randy's definition tried to address this by claiming 
absence of intermediate objects (as a generalization of the notion of 
copying).

> Note that this point has nothing to do with extended_return syntax.

Right. Also neither and no definition will work ever. Whichever syntax 
"same" object cannot be "returned".

> The RM doesn't define "location".  And the rules about 'Address are
> pretty loose.  And GNAT is correct here.

I didn't doubt it. The example was for the sake of argument. If RM 
attempted to define "same" location in a useful way that would make 
reasonable implementations impossible.

> Now, now, that's just sniping.

Yes, yes, I fired back at an attempt to evade discussion by the game of 
definitions. (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2016-01-13  8:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11  1:37 Why is the destructor called multiple times after I declare an object? Andrew Shvets
2016-01-11  2:18 ` Jeffrey R. Carter
2016-01-11  3:35   ` Andrew Shvets
2016-01-11 17:02     ` Brian Drummond
2016-01-11 16:29   ` Brian Drummond
2016-01-11 17:20     ` Simon Wright
2016-01-11 18:17     ` Bob Duff
2016-01-11 21:10       ` Dmitry A. Kazakov
2016-01-11 23:44         ` Randy Brukardt
2016-01-12  9:33           ` Dmitry A. Kazakov
2016-01-12 20:21             ` Randy Brukardt
2016-01-12 21:05               ` Dmitry A. Kazakov
2016-01-13  0:02                 ` Robert A Duff
2016-01-13  8:31                   ` Dmitry A. Kazakov [this message]
2016-01-13  9:01                     ` Georg Bauhaus
2016-01-13 14:45                     ` J-P. Rosen
2016-01-13 20:09                       ` Dmitry A. Kazakov
2016-01-14  9:04                         ` J-P. Rosen
2016-01-14  9:47                           ` Dmitry A. Kazakov
2016-01-13 16:03                     ` Robert A Duff
2016-01-13 19:59                       ` Dmitry A. Kazakov
2016-01-14 10:04                         ` Georg Bauhaus
2016-01-14 13:42                           ` Dmitry A. Kazakov
2016-01-12 12:41       ` Brian Drummond
2016-01-13 20:18       ` Jacob Sparre Andersen
2016-01-14  1:31         ` Robert A Duff
2016-01-12  0:43     ` Jeffrey R. Carter
replies disabled

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