From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 56C36431FB6 for ; Mon, 29 Apr 2013 23:12:44 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oQs7eRCGF0Ds for ; Mon, 29 Apr 2013 23:12:39 -0700 (PDT) Received: from mx4.nic.fr (mx4.nic.fr [192.134.4.12]) by olra.theworths.org (Postfix) with ESMTP id B8DB7431FAF for ; Mon, 29 Apr 2013 23:12:39 -0700 (PDT) Received: from mx4.nic.fr (localhost [127.0.0.1]) by mx4.nic.fr (Postfix) with SMTP id 33540280785; Tue, 30 Apr 2013 08:12:37 +0200 (CEST) Received: from relay2.nic.fr (relay2.nic.fr [192.134.4.163]) by mx4.nic.fr (Postfix) with ESMTP id 2E82028072C; Tue, 30 Apr 2013 08:12:37 +0200 (CEST) Received: from kaki.tech.prive.nic.fr (kaki.tech.prive.sqy.nic.fr [10.10.86.114]) by relay2.nic.fr (Postfix) with ESMTP id 2CF2DB38055; Tue, 30 Apr 2013 08:12:07 +0200 (CEST) Received: by kaki.tech.prive.nic.fr (Postfix, from userid 1000) id 19A3C3F83CB; Tue, 30 Apr 2013 06:12:07 +0000 (UTC) From: Kim Minh Kaplan To: Tomi Ollila Subject: Re: [PATCH] don't store temporary value returned from c_str() References: <1366405933-17223-1-git-send-email-Vladimir.Marek@oracle.com> <20130427101134.GI10394@pub.cz.oracle.com> Date: Tue, 30 Apr 2013 06:12:06 +0000 In-Reply-To: <20130427101134.GI10394@pub.cz.oracle.com> (Vladimir Marek's message of "Sat, 27 Apr 2013 12:11:35 +0200") Message-ID: <8761z4h7ih.fsf@kaki.tech.prive.nic.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org, Vladimir Marek X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 06:12:44 -0000 Vladimir Marek writes: > Well, a) standards says that > > A temporary bound to a reference parameter in a function call (5.2.2) > persists until the completion of the full expression containing the call > > (you can find the message all over the net, but I can't find actual link > to the standard :-/) The january 2012 working draft:=20 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf 12.2 Temporary objects [class.temporary] 1 Temporaries of class type are created in various contexts: binding a reference to a prvalue (8.5.3), returning a prvalue (6.6.3) [=E2=80=A6] 3 When an implementation introduces a temporary object of a class that has a non-trivial constructor (12.1, 12.8), it shall ensure that a constructor is called for the temporary object. Similarly, the destructor shall be called for a temporary with a non-trivial destructor (12.4). Temporary objects are destroyed as the last step in evaluating the full-expression (1.9) that (lexically) contains the point where they were created. Kim Minh.