220 12644 <507AB10F-66B5-4E72-AF78-98B4AECBE6B3@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Usability extensions to offsetof
Date: Wed, 3 Sep 2014 12:46:39 +0800
Lines: 81
Approved: news@gmane.org
Message-ID: <507AB10F-66B5-4E72-AF78-98B4AECBE6B3@gmail.com>
References: <fc4c748a-1805-4e92-ae3f-58bbfe6b7537@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_7A7F992C-532A-4032-8EF8-97F739D2CC24"
X-Trace: ger.gmane.org 1409719613 3603 80.91.229.3 (3 Sep 2014 04:46:53 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 3 Sep 2014 04:46:53 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBNF2TKQAKGQEZO3HDNY@isocpp.org Wed Sep 03 06:46:47 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBNF2TKQAKGQEZO3HDNY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f200.google.com ([209.85.160.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBNF2TKQAKGQEZO3HDNY@isocpp.org>)
	id 1XP2Sz-000358-O5
	for gclcip-std-proposals@m.gmane.org; Wed, 03 Sep 2014 06:46:46 +0200
Original-Received: by mail-yk0-f200.google.com with SMTP id 9sf25654052ykp.7
        for <gclcip-std-proposals@m.gmane.org>; Tue, 02 Sep 2014 21:46:44 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-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=wyRurOJ1STuLuIT0Y+xvzf3Ga8t5e4M/F4eSUbAiQK4=;
        b=ltsCPikOZTfP+YSi5uUx/s0Jq6xpy2IPK1zNf9a+iqmzJnhfjbAT4+TMdKR/Uw4vv7
         vLeslxG2BuPuEDZeUCHqhIt4b/9S+Ep4kZ7OW7fKsMMRG5rZ/3CTxcxCJTC9aI7nt/Hw
         JRuTb6GQTF0lDjtx3BgNzXiMylgYOSNEjotDgggW+wRNTNvzeeX7HHCr5KRRDyj625Fd
         YhcYv3yZf+HGQGlCtmHj4Jvhm+rxT3s1mHIWwlPjTpaSRrXulkFK20El7o5cAcN71BqE
         MaHoU/x5Ov7YoDGnNl3owrZUqSNa7NMtUW0MEyRLVN7EPOb8YtUcb7SZSyKgVSPIjtE0
         FFZg==
X-Gm-Message-State: ALoCoQlUGn1v96vXzeUSu/YlysiLSBWSV+xi/8hKHfeLM0a1qEOD/Nt6CieePUE11RA/QdI/MY7F
X-Received: by 10.236.118.37 with SMTP id k25mr19435289yhh.1.1409719604649;
        Tue, 02 Sep 2014 21:46:44 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.43.135 with SMTP id w7ls2869582igl.21.canary; Tue, 02 Sep
 2014 21:46:44 -0700 (PDT)
X-Received: by 10.66.197.132 with SMTP id iu4mr18336011pac.132.1409719604020;
        Tue, 02 Sep 2014 21:46:44 -0700 (PDT)
Original-Received: from mail-pd0-x22b.google.com (mail-pd0-x22b.google.com [2607:f8b0:400e:c02::22b])
        by mx.google.com with ESMTPS id s2si9079178pdj.41.2014.09.02.21.46.44
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 02 Sep 2014 21:46:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c02::22b as permitted sender) client-ip=2607:f8b0:400e:c02::22b;
Original-Received: by mail-pd0-f171.google.com with SMTP id y13so10196317pdi.30
        for <std-proposals@isocpp.org>; Tue, 02 Sep 2014 21:46:43 -0700 (PDT)
X-Received: by 10.70.61.162 with SMTP id q2mr53397975pdr.50.1409719603856;
        Tue, 02 Sep 2014 21:46:43 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.44.91])
        by mx.google.com with ESMTPSA id zf5sm5574253pbc.44.2014.09.02.21.46.42
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 02 Sep 2014 21:46:43 -0700 (PDT)
In-Reply-To: <fc4c748a-1805-4e92-ae3f-58bbfe6b7537@isocpp.org>
X-Mailer: Apple Mail (2.1878.6)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c02::22b as permitted
 sender) smtp.mail=potswa@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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:12644
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12644>

--Apple-Mail=_7A7F992C-532A-4032-8EF8-97F739D2CC24
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-09-03, at 12:37 PM, Myriachan <myriachan@gmail.com> wrote:

> As a generalization of std::is_standard_layout, how about an std::is_offs=
etof_compatible?  Requiring standard-layout in order to use offsetof is too=
 restrictive; almost all implementations could support offsetof in more sit=
uations than the Standard's "standard-layout" definition allows.

offsetof is a vestige of C compatibility, and standard layout is specifical=
ly tailored to C ABI compatibility. So the restriction is probably exactly =
what its designers intended.

Where would you prefer to use offsetof, instead of a pointer-to-member?

> With this, there could also be member_pointer_to_offset and offset_to_mem=
ber_pointer library functions that work with compatible classes.

There always could have been, but why?

--=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/.

--Apple-Mail=_7A7F992C-532A-4032-8EF8-97F739D2CC24
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;09&ndash;03, at 12:37 PM, Myriachan &lt;<a href=3D"mailto:myriachan@g=
mail.com">myriachan@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-interc=
hange-newline"><blockquote type=3D"cite"><div dir=3D"ltr">As a generalizati=
on of <span style=3D"font-family: courier new,monospace;">std::is_standard_=
layout</span>, how about an <span style=3D"font-family: courier new,monospa=
ce;">std::is_offsetof_compatible</span>?&nbsp; Requiring standard-layout in=
 order to use <span style=3D"font-family: courier new,monospace;">offsetof<=
/span> is too restrictive; almost all implementations could support <span s=
tyle=3D"font-family: courier new,monospace;">offsetof</span> in more situat=
ions than the Standard's "standard-layout" definition allows.<br></div></bl=
ockquote><div><br></div><div><font face=3D"Courier">offsetof</font> is a ve=
stige of C compatibility, and standard layout is specifically tailored to C=
 ABI compatibility. So the restriction is probably exactly what its designe=
rs intended.</div><div><br></div><div>Where would you prefer to use <font f=
ace=3D"Courier">offsetof</font>, instead of a pointer-to-member?</div><br><=
blockquote type=3D"cite"><div dir=3D"ltr">With this, there could also be <s=
pan style=3D"font-family: 'courier new', monospace;">member_pointer_to_offs=
et</span> and <span style=3D"font-family: 'courier new', monospace;">offset=
_to_member_pointer</span> library functions that work with compatible class=
es.</div></blockquote><br></div><div>There always could have been, but why?=
</div><div><br></div></body></html>

<p></p>

-- <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+unsubscribe@isocpp.org">std-proposa=
ls+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/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_7A7F992C-532A-4032-8EF8-97F739D2CC24--

.
