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!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Why is the destructor called multiple times after I declare an object? Date: Wed, 13 Jan 2016 15:45:55 +0100 Organization: A noiseless patient Spider Message-ID: References: <293c58ac-4ebd-488a-abcc-b6e88811eec8@googlegroups.com> <871t9ogevj.fsf@theworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 13 Jan 2016 14:43:16 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="45bffd6a911624777cad79aac3181090"; logging-data="10574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PORqtpQru648WDDPNf8K5" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: Cancel-Lock: sha1:lD8OVdMGqUw4cznL/BNk8ES0hZs= Xref: news.eternal-september.org comp.lang.ada:29115 Date: 2016-01-13T15:45:55+01:00 List-Id: Le 13/01/2016 09:31, Dmitry A. Kazakov a écrit : > On 13/01/2016 01:02, Robert A Duff wrote: >> "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. > OK, let's state it differently. The called function builds its result "somewhere". That "somewhere" is what will be used by the caller as the variable being initialized. It is perfectly OK if the function starts building the result in "somewhere_1", then decides to switch to "somewhere_2", as long as the eventual "somewhere" is what is used by the caller, /without copy/. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr