From 3d2df109f65c357b0af96d7d5ad33ee604c4bb37 Mon Sep 17 00:00:00 2001 From: Kim Minh Kaplan Date: Tue, 30 Apr 2013 06:12:06 +0000 Subject: [PATCH] Re: [PATCH] don't store temporary value returned from c_str() --- 43/c0bf57e8dfb1291f68ee1836670b5bfe34ce42 | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 43/c0bf57e8dfb1291f68ee1836670b5bfe34ce42 diff --git a/43/c0bf57e8dfb1291f68ee1836670b5bfe34ce42 b/43/c0bf57e8dfb1291f68ee1836670b5bfe34ce42 new file mode 100644 index 000000000..f137068c9 --- /dev/null +++ b/43/c0bf57e8dfb1291f68ee1836670b5bfe34ce42 @@ -0,0 +1,86 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +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. -- 2.26.2