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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Why is the destructor called multiple times after I declare an object? Date: Wed, 13 Jan 2016 09:31:11 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <293c58ac-4ebd-488a-abcc-b6e88811eec8@googlegroups.com> <871t9ogevj.fsf@theworld.com> NNTP-Posting-Host: bqgfK7NL3xTHnr0WRaLl4g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:29113 Date: 2016-01-13T09:31:11+01:00 List-Id: On 13/01/2016 01:02, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On 2016-01-12 21:21, Randy Brukardt wrote: >>> "Dmitry A. Kazakov" wrote in message >>> news:n72hag$bjq$1@gioia.aioe.org... >>>> On 12/01/2016 00:44, Randy Brukardt wrote: >>>>> "Dmitry A. Kazakov" 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