220 7594 <CAOUeGfu4VBR4LoVKQW8vJ029WZZWt7gLqm=QeKShCZ_6bg=rpQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: xavi <gratal@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Fixing the private method issue
Date: Mon, 4 Nov 2013 19:14:48 +0100
Lines: 136
Approved: news@gmane.org
Message-ID: <CAOUeGfu4VBR4LoVKQW8vJ029WZZWt7gLqm=QeKShCZ_6bg=rpQ@mail.gmail.com>
References: <d5cd9fa5-ac2f-465b-b92d-cf2a35607245@isocpp.org>
	<CAA7U3HOa+Nf8mXZGpUKJxi5hZ5=gEE-Q5aeRridTpNm1Gpu0rQ@mail.gmail.com>
	<CAOUeGfuhdU5X4ZWELe-Zx1q3sk3tbCwdvnsLEY0QjVnkiPBbhg@mail.gmail.com>
	<1552463.5qu4FCA00r@tjmaciei-mobl2>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e013cba283d00be04ea5de432
X-Trace: ger.gmane.org 1383588885 20988 80.91.229.3 (4 Nov 2013 18:14:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 4 Nov 2013 18:14:45 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCWJHYVQY4OBBGOI36JQKGQERX5X35Q@isocpp.org Mon Nov 04 19:14:51 2013
Return-path: <std-proposals+bncBCWJHYVQY4OBBGOI36JQKGQERX5X35Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qc0-f198.google.com ([209.85.216.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCWJHYVQY4OBBGOI36JQKGQERX5X35Q@isocpp.org>)
	id 1VdOfq-00049N-QA
	for gclcip-std-proposals@m.gmane.org; Mon, 04 Nov 2013 19:14:51 +0100
Original-Received: by mail-qc0-f198.google.com with SMTP id k18sf13620385qcv.9
        for <gclcip-std-proposals@m.gmane.org>; Mon, 04 Nov 2013 10:14:50 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=LUz2tktWvDAqU7PxobDY8+uvKU+o0b3tTjYKust5KT8=;
        b=AODDhqJyo/tyth/MHMfVFzT5CTxNIC9RJccGNcad0nfDKCmkYQxx+RoZV0sXsk2mam
         j/cl362+FbWzFRNLk/6+Bk3EQlCNUp43QEK5VfWTsy+YSCqMQOTP5tfzsIKAsFPkTuUY
         c4QRF1Z1kfzDZsKqWxTVL4vYvFAkM2Dk6rAO75kA2HbjKq58ueQqsEWTFuy3H+pPFIdf
         52rNkX6u5WfHZufaywUOSqLaLLueyGRiKVoYbdngaZkCwnSuV9FZKsgjMAn9FxOTdB51
         16Z9LK7RCb72aEXE86x3X6ppf1STcHByv2Joy2snHWfvuaEgKHs1a/bm9d6xERx+DGms
         Is7Q==
X-Gm-Message-State: ALoCoQkJbF1IOvG4Tsv5pQCAddSqCcMBHLiGZ7KCFU/jybyG2o2w5sh/yNEXwctIMMB7bna98MJD
X-Received: by 10.224.24.65 with SMTP id u1mr8803085qab.6.1383588890005;
        Mon, 04 Nov 2013 10:14:50 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.74.198 with SMTP id w6ls2489577qev.9.gmail; Mon, 04 Nov
 2013 10:14:49 -0800 (PST)
X-Received: by 10.49.29.130 with SMTP id k2mr23441901qeh.20.1383588889148;
        Mon, 04 Nov 2013 10:14:49 -0800 (PST)
Original-Received: from mail-qa0-x235.google.com (mail-qa0-x235.google.com [2607:f8b0:400d:c00::235])
        by mx.google.com with ESMTPS id by3si4191630qcb.87.2013.11.04.10.14.49
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 04 Nov 2013 10:14:49 -0800 (PST)
Received-SPF: pass (google.com: domain of gratal@gmail.com designates 2607:f8b0:400d:c00::235 as permitted sender) client-ip=2607:f8b0:400d:c00::235;
Original-Received: by mail-qa0-f53.google.com with SMTP id k4so425694qaq.5
        for <std-proposals@isocpp.org>; Mon, 04 Nov 2013 10:14:49 -0800 (PST)
X-Received: by 10.224.57.68 with SMTP id b4mr24416960qah.63.1383588888901;
 Mon, 04 Nov 2013 10:14:48 -0800 (PST)
Original-Received: by 10.96.185.66 with HTTP; Mon, 4 Nov 2013 10:14:48 -0800 (PST)
In-Reply-To: <1552463.5qu4FCA00r@tjmaciei-mobl2>
X-Original-Sender: gratal@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gratal@gmail.com designates 2607:f8b0:400d:c00::235 as permitted
 sender) smtp.mail=gratal@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7594
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7594>

--089e013cba283d00be04ea5de432
Content-Type: text/plain; charset=ISO-8859-1

As long as you store the pimpl pointer in a local variable (so that the
compiler knows that the pointer doesn't change no matter what you call),
the compiler can generate exactly the same code for accessing members of
pimpl as it would for accessing members of this (which is a pointer, after
all). As for the private class being exported, that's the kind of details
that the standard usually leaves to implementations, and a good compiler
with link-time optimization would be able to remove these symbols anyway.


2013/11/4 Thiago Macieira <thiago@macieira.org>

> On segunda-feira, 4 de novembro de 2013 18:11:01, xavi wrote:
> > Allowing the declaration of private member data outside of the header
> would
> > also make inheritance or composition with this class impossible, so any
> use
> > of this class would need to be through a pointer. In this case, what
> would
> > be the advantage of this with respect to using the pimpl idiom?
>
> It would simplify the code for the implementation. A good pimpl solution
> requires all public functions to be mirrored in the private so that you
> don't
> get a double indirection to the data (it also improves code generation
> because
> the private class isn't exported).
>
> This would be basically a way for C++ place member functions in opaque
> types.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e013cba283d00be04ea5de432
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As long as you store the pimpl pointer in a local variable=
 (so that the compiler knows that the pointer doesn&#39;t change no matter =
what you call), the compiler can generate exactly the same code for accessi=
ng members of pimpl as it would for accessing members of this (which is a p=
ointer, after all). As for the private class being exported, that&#39;s the=
 kind of details that the standard usually leaves to implementations, and a=
 good compiler with link-time optimization would be able to remove these sy=
mbols anyway.</div>
<div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11/4 Thi=
ago Macieira <span dir=3D"ltr">&lt;<a href=3D"mailto:thiago@macieira.org" t=
arget=3D"_blank">thiago@macieira.org</a>&gt;</span><br><blockquote class=3D=
"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex">
<div class=3D"im">On segunda-feira, 4 de novembro de 2013 18:11:01, xavi wr=
ote:<br>
&gt; Allowing the declaration of private member data outside of the header =
would<br>
&gt; also make inheritance or composition with this class impossible, so an=
y use<br>
&gt; of this class would need to be through a pointer. In this case, what w=
ould<br>
&gt; be the advantage of this with respect to using the pimpl idiom?<br>
<br>
</div>It would simplify the code for the implementation. A good pimpl solut=
ion<br>
requires all public functions to be mirrored in the private so that you don=
&#39;t<br>
get a double indirection to the data (it also improves code generation beca=
use<br>
the private class isn&#39;t exported).<br>
<br>
This would be basically a way for C++ place member functions in opaque type=
s.<br>
<div class=3D"im HOEnZb"><br>
--<br>
Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=3D"_b=
lank">macieira.info</a> - thiago (AT) <a href=3D"http://kde.org" target=3D"=
_blank">kde.org</a><br>
=A0 =A0Software Architect - Intel Open Source Technology Center<br>
=A0 =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint:<br>
=A0 =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358<br>
<br>
</div><div class=3D"HOEnZb"><div class=3D"h5">--<br>
<br>
---<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e013cba283d00be04ea5de432--

.
