220 36063 <caca241d-3498-b79b-fbf3-e57d8b7c3518@technion.ac.il> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Eyal Rozenberg <eyalroz@technion.ac.il>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Sub-objects and their copy ellision
Date: Tue, 19 Dec 2017 18:34:31 +0100
Lines: 49
Approved: news@gmane.org
Message-ID: <caca241d-3498-b79b-fbf3-e57d8b7c3518@technion.ac.il>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1513704761 22166 195.159.176.226 (19 Dec 2017 17:32:41 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 19 Dec 2017 17:32:41 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101
 Thunderbird/57.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDHKZN7LR4ARBLM34XIQKGQETSGJQII@isocpp.org Tue Dec 19 18:32:37 2017
Return-path: <std-proposals+bncBDHKZN7LR4ARBLM34XIQKGQETSGJQII@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f70.google.com ([74.125.82.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDHKZN7LR4ARBLM34XIQKGQETSGJQII@isocpp.org>)
	id 1eRLkq-0005Lg-Pb
	for gclcip-std-proposals@m.gmane.org; Tue, 19 Dec 2017 18:32:36 +0100
Original-Received: by mail-wm0-f70.google.com with SMTP id w141sf1507251wme.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 19 Dec 2017 09:34:39 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1513704879; cv=pass;
        d=google.com; s=arc-20160816;
        b=DLhur3s5rmOXWzp8xrkk0VL5noOIEaHYXMdkVFStgWozA0+oim+MGkVGJYOYEzotFQ
         toWhgMiHiA3X+CTHouiU59u6ZJWCIPtgdpWCzHQBr6aXZN3F9jVFwAvhOyCp5jDxj02C
         RaQxRQWMX6k0zWgVUIoShDGa0BgJHbfbpgvAJgU7d/eHobUvAEZG11YdSy9Xa4TWjjz8
         j/icdFss7y6eoVSgC8SS/5jDsgIqWp4sQ+SIaIB/uYG7eEDhDYqxQ3LpXkPFZ8bKigRU
         Vf1EcEQ5HVJbOqJsWcDZjQFuqIYBOm0hjxuqQZ7pZ7uQ+GjkTre5q2pItJ89rfbO2jjH
         Nsbg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :mime-version:user-agent:date:message-id:openpgp:subject:from:to
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=2nJpXQiwUNM9BoA1VMf8jIATKrJZkFem3wzHpKvVDrw=;
        b=uZNvkloVnsWSgWDSAwoIcdSruI+NTt8dRHrZKJcNvb1BW44pMeqkUQBkk0zZSeHME5
         RywR6+OqPPxiru2qaRKdgCXLW6YzwrVCaES+VAQve4AjlqjchIIT55jpcKZNBx2hcBCX
         dILaFBzljAlXIG+dSwbJEddsDGSKcKky7ZxoofViWGXw28VWjuIttL57/vQvZ51+0uAF
         Zhnu0KqVm2sgCzCinT+rBxfUXqJsoZBFsBcvE0KuTqSOhEc8JPWc3CSBf2wuhRwKWDEp
         f5+OY8AMd12ShyNNLonNBJKwUkSbnpHWvRSLsg6h4JTCnAfs/1JJwbXiDkr3FLv9Kc02
         nv1A==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of srs0=kaojp=dp=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=KAOJP=DP=technion.ac.il=eyalroz@cwi.nl;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=technion.ac.il
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:openpgp:message-id:date:user-agent:mime-version
         :content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=2nJpXQiwUNM9BoA1VMf8jIATKrJZkFem3wzHpKvVDrw=;
        b=FAMUOQiBkKFDQgwvARHHJ3Hv/tFiTpqlOMglS3LFFmREWlJGBSpQxOedkCAOYTnZdi
         X6yzpF41pctout8P7oRKOnsqjGvZNMR/aPuAck6jTvquw/EYZXVMHxYB/+peZUyQJje1
         +y6KpXzT2mV2WFGIk4l5J+otEdvnR6Rzj9qYLRoUrXUUxWipG3AZo3rSDTXDbfMN8O9q
         ZVPt0L7ujMAhggd7UFR3m0IFRslsr4t2MmdomVgQ2AiXbvpWGI+7uzGAs9nXIa4L7VvT
         HZTdOe3f22LfB0twTysGy+9ZWcjx/nmNq9zBgU2E6oiut7tW/pQnpaxK0bbK7Snu0UIU
         yZhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:openpgp:message-id:date
         :user-agent:mime-version:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=2nJpXQiwUNM9BoA1VMf8jIATKrJZkFem3wzHpKvVDrw=;
        b=o2VlRxYYdsAmIkO3UXbZ3ykOJzcosk/nIoH+yTSiQlzf1kTjijvw5YEADU8PbGYcJg
         GEYMPtRtx6yY9sTcsq3dX0dwYVKT+1vASyDjFbWZrEq2FbYFfI5VsQVbvhhttXT1mDCJ
         2aNlBBwmy5Y3RlobHZlPgiMhJf6JfCE5mJg17od6CyB+UcbwLgI0TLO3HsTwcT3DLNAR
         aoTJ+gc2luP38bOU0/riQ1PFOHT4OuIEN4Q2gDs5zlldnEvX7dQW4E95X4j/vOq0sES6
         ev9EQjo6wAcr0dCaz3J2hhsMNyA4Gt0lLJmQ/tPpo50ac5esMWzKu9Tq8Lz5sPyY/lUE
         GejQ==
X-Gm-Message-State: AKGB3mJ5aCITK8Ym0PgOH3C+MBn/xEzy5hqy39EMG3PeNLdjJ/I3sU7I
	X04RMTZv/how8GjhTc89aGM=
X-Google-Smtp-Source: ACJfBos65nCIl8TOlganxpI/xAEOPfQ5dlFRi5XhisK85pj8+P0KYKd+bet2MXl/aTM1ketOBN2H+g==
X-Received: by 10.80.164.203 with SMTP id x11mr402616edb.7.1513704879287;
        Tue, 19 Dec 2017 09:34:39 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.80.154.229 with SMTP id p92ls6816922edb.8.gmail; Tue, 19 Dec
 2017 09:34:37 -0800 (PST)
X-Received: by 10.80.149.141 with SMTP id w13mr1580360eda.79.1513704877348;
        Tue, 19 Dec 2017 09:34:37 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1513704877; cv=none;
        d=google.com; s=arc-20160816;
        b=QnWcA2XugcpGrbTTvvNTRY/Qmo+QkXLTb260JkVgca3RXYUNfpMQF0ZgmIrSrMUfng
         DgMmZD+4EU0GtUFY9sOKnOIw3KERP2AOGOqkRnwWsmL1YAw6j+8hrqZX+mElwZYh/F4j
         pGM/1ROMPw2Nl+QAoCDgyLNBKWFOzJw/Qqn25gBj2erR3PelIVcTMGCK+qGo037usxbP
         zUFS4T0u1w9XRN463wFFeUsJxxrUwHYNJZxo1GlIL8Ksukxox83TRRAtCDHKsyQl1000
         YRx4XWX8TF2S3CDlVwulZR2E+shnDeEvyqtH1U757Sp4M0+7oXcq2O3wLGn/AiJPXW62
         R8UA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:mime-version:user-agent
         :date:message-id:openpgp:subject:from:to:arc-authentication-results;
        bh=qo8vifYknBKVIfUaNB8+LYEfzE8UjbV0vpqdz1yBCck=;
        b=NpMuWsYwSD3dj0rVLbBMjzi7MqDO41xLg0X0ecaud48hvBRWtUVqCwUMiHw+AQ4cDC
         SfbIJaRonM6DjAvvnOwS5zkhrQd+q4mfCgEqJYjfHtIO3fZaP9utEahN7I3X75GRLHga
         QVz1PY/R08bV1T2Tr3OXwTpUVovp4eI9kXPzOle2TLC68buHDMQR7dVAztRUXdhFUh/S
         5GKK7DreFQSFzntK1DP6JjJKAXAbN80lOfh7mF6p5KxiOmy8VEOOUwBoBREztl/a6lDL
         LMYVMskk2nu9uFHdV9GtLHKTxUH871C/sRJH5u4vrY/OF/NBpc4pxb0mMOffPzwubUzp
         6Skw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of srs0=kaojp=dp=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=KAOJP=DP=technion.ac.il=eyalroz@cwi.nl;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=technion.ac.il
Original-Received: from fester.cwi.nl (fester.cwi.nl. [192.16.191.27])
        by mx.google.com with ESMTPS id z34si1224754edz.7.2017.12.19.09.34.37
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 19 Dec 2017 09:34:37 -0800 (PST)
Received-SPF: pass (google.com: domain of srs0=kaojp=dp=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) client-ip=192.16.191.27;
Original-Received: from fester.cwi.nl (fester.cwi.nl [192.16.191.27])
	by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id vBJHYb9i024544
	for <std-proposals@isocpp.org>; Tue, 19 Dec 2017 18:34:37 +0100
Original-Received: from [192.168.2.1] (ip565d4370.direct-adsl.nl [86.93.67.112] (may be forged))
	(authenticated bits=0)
	by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id vBJHYagj024542
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO)
	for <std-proposals@isocpp.org>; Tue, 19 Dec 2017 18:34:37 +0100
Openpgp: preference=signencrypt
Content-Language: en-US
X-Original-Sender: eyalroz@technion.ac.il
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of srs0=kaojp=dp=technion.ac.il=eyalroz@cwi.nl designates
 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=KAOJP=DP=technion.ac.il=eyalroz@cwi.nl;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=technion.ac.il
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:36063
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36063>


Hello list,

I've recently gone over Antony Polukhin's proposal (or proposal draft)
regarding subobject copy elision:

https://apolukhin.github.io/papers/subobjects_copy_elision.html

where he describes how, at the moment, if your function returns fields
in an object, compilers do not construct them where the output needs to
be placed, and consequently generate much longer and slower code.

Supposedly, this is due to the standard's provision regarding copy
elision, [class.copy.elision], which says that elision is permitted:

"... in a return statement in a function with a class return type, when
the expression is the name of a non-volatile automatic object etc. etc."

As I was reading the paper, it made me wonder: Why does it matter that
these are subobjects? Aren't subobjects just another kind of object?

So I looked it up in the current standard draft:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4700.pdf

and, indeed, in Section [intro.object], we find the definition of a
subobject:

"Objects can contain other objects, called \emph{subobjects}"

that is to say, subobjects _are_ objects. And if an object has automatic
storage duration, then so do its (non-static) subobjects. Well, then,
why is it the case that copy elision doesn't occur for subobjects? And
is this proposal really necessary, or is it just an unimaginative
interpretation of the wording of [class.copy.elision] by compiler
implementers?


I'm hoping some language lawyers or compiler people can shed some light
on this point.

Eyal

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/caca241d-3498-b79b-fbf3-e57d8b7c3518%40technion.ac.il.

.
