220 9237 <848819e9-04cf-42b6-9ee6-13cf2ff6dc95@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Comments on 2d api for c++ N3888.pdf
Date: Sun, 9 Feb 2014 15:12:18 -0800 (PST)
Lines: 157
Approved: news@gmane.org
Message-ID: <848819e9-04cf-42b6-9ee6-13cf2ff6dc95@isocpp.org>
References: <9105f9b2-e15d-4bf8-a4a1-65ebc3657eb0@isocpp.org> <1499411.eehuFWK7Yv@tjmaciei-mobl2> <8a29e404-8218-4853-9db9-d4030709ab43@isocpp.org>
 <6822200.TbR7qDM6I7@tjmaciei-mobl4>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_2661_7413169.1391987538228"
X-Trace: ger.gmane.org 1391987537 10697 80.91.229.3 (9 Feb 2014 23:12:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 9 Feb 2014 23:12:17 +0000 (UTC)
Cc: thiago@macieira.info
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCRIRSPDTQIRBUUW4CLQKGQEPZYCNOY@isocpp.org Mon Feb 10 00:12:24 2014
Return-path: <std-proposals+bncBCRIRSPDTQIRBUUW4CLQKGQEPZYCNOY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f199.google.com ([209.85.160.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCRIRSPDTQIRBUUW4CLQKGQEPZYCNOY@isocpp.org>)
	id 1WCdXw-00018i-Cv
	for gclcip-std-proposals@m.gmane.org; Mon, 10 Feb 2014 00:12:20 +0100
Original-Received: by mail-yk0-f199.google.com with SMTP id 10sf12489214ykt.2
        for <gclcip-std-proposals@m.gmane.org>; Sun, 09 Feb 2014 15:12:19 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=1LuaBqIiyFf/xqBN0/2OPKgtjwr7iUWiSx6BBB4dP7Q=;
        b=EfpJU9DxHK61HI3tGIlQETvbWcWx2qEfmc5Ri5CKcWcI5Mov0Uqyxjh12FbFKcxvno
         +FDp5QrhQoIcSTRmFz+Re5tjYQ8koodAXubnOZzbJnvtK+EneOTWicZXUnQhiu9dZV6P
         yhnJE41SoVHmdKTAkOlLp6ZWEDDjosWp7YEyvMD0XMeq4sHMqWaZxm8nPvszCNdWXojh
         0+KmRcwS9BX9OgLfU4O1a8q2o1X5oKkCKQKm6wSB7/3CkfGu7y24+D/5YMilv8rAVgsG
         8vng4qowzQG3iE2yKi3YGNmKllbXidfk80ms+RwU9vNMGQ7pRzbXKb9bsanWAYn45EbB
         a2pA==
X-Gm-Message-State: ALoCoQlcxO7cIxMvIrpZqUhi4bTtM2OgLLkO2pZzsvsU14WLEOkLymgVSJTy8o5ZDhIBpzTLBTi/
X-Received: by 10.52.29.16 with SMTP id f16mr9518843vdh.8.1391987539219;
        Sun, 09 Feb 2014 15:12:19 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.108.135 with SMTP id j7ls1809130qgf.88.gmail; Sun, 09 Feb
 2014 15:12:18 -0800 (PST)
X-Received: by 10.140.94.11 with SMTP id f11mr578267qge.7.1391987538622;
        Sun, 09 Feb 2014 15:12:18 -0800 (PST)
In-Reply-To: <6822200.TbR7qDM6I7@tjmaciei-mobl4>
X-Original-Sender: bengt.gustafsson@beamways.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:9237
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9237>

------=_Part_2661_7413169.1391987538228
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

The compiler will definitely inline those trivial adaptor methods which=20
look like this or very similar:

getx(const my_point& p) { return p.x; }

It won't generate any object code bloat at all. The alternative, using a=20
std::drawing specific point class will however require creating a temprary=
=20
object which in some cases is harder to optimize away, and introduces a lot=
=20
of SOURCE code bloat:

dc.draw_point(std::drawing::point(p.x, p.y));

instead of:

dc.draw_point(p);

I think this is quite compelling!

By the way: Drawing methods such as draw_polygon which take a range of=20
points can also be written to accept diffrerent types of points, although=
=20
it will be harder to optimize away copying of data, depending on the=20
underlying "device driver" implementation.


Den m=C3=A5ndagen den 3:e februari 2014 kl. 05:54:32 UTC+1 skrev Thiago Mac=
ieira:
>
> Em dom 02 fev 2014, =C3=A0s 20:14:20, Bengt Gustafsson escreveu:=20
> > About method overloads that take point or rect types. I now came to the=
=20
> > conclusion that we should have a template overload to cater for "all"=
=20
> types=20
> > of point classes the user of the library may have on hand. Can this be=
=20
> > done? Yes:=20
>
> Should it be done? IMHO, no.=20
>
> Making an entirely-template API means potentially a lot of code bloat. It=
=20
> means all of the actual API is implemented in private APIs, called by=20
> inline=20
> template methods.=20
>
> > C++ provides many tools, we must try to use all of them appropriately!=
=20
>
> Appropriately also implies that there are conditions under which some=20
> tools=20
> must not be used. I believe this to be one of them.=20
>
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
>    Software Architect - Intel Open Source Technology Center=20
>       PGP/GPG: 0x6EF45358; fingerprint:=20
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358=20
>
>

--=20

---=20
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 e=
mail 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-proposa=
ls/.

------=_Part_2661_7413169.1391987538228
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The compiler will definitely inline those trivial adaptor =
methods which look like this or very similar:<div><br></div><div>getx(const=
 my_point&amp; p) { return p.x; }</div><div><br></div><div>It won't generat=
e any object code bloat at all. The alternative, using a std::drawing speci=
fic point class will however require creating a temprary object which in so=
me cases is harder to optimize away, and introduces a lot of SOURCE code bl=
oat:</div><div><br></div><div>dc.draw_point(std::drawing::point(p.x, p.y));=
</div><div><br></div><div>instead of:</div><div><br></div><div>dc.draw_poin=
t(p);</div><div><br></div><div>I think this is quite compelling!</div><div>=
<br></div><div>By the way: Drawing methods such as draw_polygon which take =
a range of points can also be written to accept diffrerent types of points,=
 although it will be harder to optimize away copying of data, depending on =
the underlying "device driver" implementation.</div><div><br></div><div><br=
><div>Den m=C3=A5ndagen den 3:e februari 2014 kl. 05:54:32 UTC+1 skrev Thia=
go Macieira:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Em dom 02 fev 2014=
, =C3=A0s 20:14:20, Bengt Gustafsson escreveu:
<br>&gt; About method overloads that take point or rect types. I now came t=
o the
<br>&gt; conclusion that we should have a template overload to cater for "a=
ll" types
<br>&gt; of point classes the user of the library may have on hand. Can thi=
s be
<br>&gt; done? Yes:=20
<br>
<br>Should it be done? IMHO, no.
<br>
<br>Making an entirely-template API means potentially a lot of code bloat. =
It=20
<br>means all of the actual API is implemented in private APIs, called by i=
nline=20
<br>template methods.
<br>
<br>&gt; C++ provides many tools, we must try to use all of them appropriat=
ely!
<br>
<br>Appropriately also implies that there are conditions under which some t=
ools=20
<br>must not be used. I believe this to be one of them.
<br>
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%=
3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNCNanbu7euhq=
Ln_62FW8ag';return true;" onclick=3D"this.href=3D'http://www.google.com/url=
?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNC=
Nanbu7euhqLn_62FW8ag';return true;">macieira.info</a> - thiago (AT) <a href=
=3D"http://kde.org" target=3D"_blank" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQj=
CNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;" onclick=3D"this.href=3D'http:=
//www.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75=
AFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;">kde.org</a>
<br>&nbsp; &nbsp;Software Architect - Intel Open Source Technology Center
<br>&nbsp; &nbsp; &nbsp; PGP/GPG: 0x6EF45358; fingerprint:
<br>&nbsp; &nbsp; &nbsp; E067 918B B660 DBD1 105C &nbsp;966C 33F5 F005 6EF4=
 5358
<br>
<br></blockquote></div></div></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 />

------=_Part_2661_7413169.1391987538228--

.
