Re: [PATCH] configure: add --without-docs switch
[notmuch-archives.git] / 0c / 12be5225cd5f5babaf8af6920cbb445140bc85
1 Return-Path: <Vladimir.Marek@Oracle.COM>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 64D8E431FAF\r
6         for <notmuch@notmuchmail.org>; Wed,  1 May 2013 04:30:27 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.299\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id lB+-6ahJ-ypu for <notmuch@notmuchmail.org>;\r
17         Wed,  1 May 2013 04:30:21 -0700 (PDT)\r
18 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 309DA431FC0\r
22         for <notmuch@notmuchmail.org>; Wed,  1 May 2013 04:30:20 -0700 (PDT)\r
23 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237])\r
24         by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with\r
25         ESMTP id r41BU6K2011375\r
26         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
27         Wed, 1 May 2013 11:30:07 GMT\r
28 Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230])\r
29         by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
30         r41BU4b0003921\r
31         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL);\r
32         Wed, 1 May 2013 11:30:04 GMT\r
33 Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67])\r
34         by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
35         r41BU36E003914; Wed, 1 May 2013 11:30:03 GMT\r
36 Received: from pub.cz.oracle.com (/10.163.101.122)\r
37         by default (Oracle Beehive Gateway v4.0)\r
38         with ESMTP ; Wed, 01 May 2013 04:30:03 -0700\r
39 Date: Wed, 1 May 2013 13:28:06 +0200\r
40 From: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
41 To: Kim Minh Kaplan <kimminh.kaplan+nomuch@afnic.fr>\r
42 Subject: Re: [PATCH] don't store temporary value returned from c_str()\r
43 Message-ID: <20130501112806.GD19599@pub.cz.oracle.com>\r
44 Mail-Followup-To: Kim Minh Kaplan <kimminh.kaplan+nomuch@afnic.fr>,\r
45         Vladimir Marek <vlmarek@volny.cz>, Tomi Ollila <tomi.ollila@iki.fi>,\r
46         notmuch@notmuchmail.org\r
47 References: <1366405933-17223-1-git-send-email-Vladimir.Marek@oracle.com>\r
48         <m2sj2cjp2b.fsf@guru.guru-group.fi>\r
49         <20130427101134.GI10394@pub.cz.oracle.com>\r
50         <8761z4h7ih.fsf@kaki.tech.prive.nic.fr>\r
51         <20130430084852.GA19599@pub.cz.oracle.com>\r
52         <87ehdsfj4u.fsf@kaki.tech.prive.nic.fr>\r
53 MIME-Version: 1.0\r
54 Content-Type: text/plain; charset=utf-8\r
55 Content-Disposition: inline\r
56 In-Reply-To: <87ehdsfj4u.fsf@kaki.tech.prive.nic.fr>\r
57 User-Agent: Mutt/1.5.21 (2010-09-15)\r
58 X-Source-IP: acsinet21.oracle.com [141.146.126.237]\r
59 Cc: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org,\r
60         Vladimir Marek <vlmarek@volny.cz>\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Wed, 01 May 2013 11:30:27 -0000\r
74 \r
75 > You have to somehow instantiate a temporary object, using a function\r
76 > call for example.\r
77\r
78 >     #include <string.h>\r
79 >     #include <stdio.h>\r
80 >     struct example {\r
81 >       char data[10];\r
82 >       char *c_str() { return data; }\r
83 >      example() { strcpy(data, "test"); }\r
84 >       ~example() { strcpy(data, "destroyed"); }\r
85 >     };\r
86 >     example foo()\r
87 >     {\r
88 >       example res;\r
89 >       return res;\r
90 >     }\r
91 >     main()\r
92 >     {\r
93 >       printf("%s\n", foo().c_str());\r
94 >       char *x = foo().c_str();\r
95 >       printf("%s\n", x);\r
96 >     }\r
97 \r
98 Right. After more tests I think I'm getting hang of it. In my examples I\r
99 had function similar to\r
100 \r
101 char *foo() {\r
102   example res;\r
103   return res.c_str();\r
104 }\r
105 \r
106 In this case the reference returned is to _char pointer_ and not to\r
107 example struct. So the struct is destroyed before returning from foo to\r
108 caller. Compiler does not understand that the returned char pointer does\r
109 not have any meaning without the example struct.\r
110 \r
111 This is where I was doing the mistake, I believe.\r
112 \r
113 Thank you\r
114 -- \r
115         Vlad\r