220 37363 <64578641-a89f-4b60-82ce-5183a54a3630@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: `offsetof` in a macro-less, modular world
Date: Fri, 16 Mar 2018 10:23:11 -0700 (PDT)
Lines: 120
Approved: news@gmane.org
Message-ID: <64578641-a89f-4b60-82ce-5183a54a3630@isocpp.org>
References: <c5f5ccc4-3267-442d-8cb2-de1ae103a38e@isocpp.org>
 <CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO+A7CMm9XBUC96g@mail.gmail.com>
 <e7a864e9-a866-40d6-9688-95219dc34d92@isocpp.org> <71ed1718-d272-4920-92fe-3b59750e6fb8@isocpp.org>
 <CAHSYqdaG06U9DwCW57=UM5GrUHkXWV9Ah5u+1wDrisBSo_nQig@mail.gmail.com> <22ef47e6-e957-4519-820f-1decb09a116d@isocpp.org>
 <CAHSYqdZA9zarj3qL0otGwaQQU-g2Tkk7jEmWziFBWz=iYR2ANg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1850_1285662006.1521220991948"
X-Trace: blaine.gmane.org 1521220873 6093 195.159.176.226 (16 Mar 2018 17:21:13 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Mar 2018 17:21:13 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBAP3V7KQKGQESJF4IAI@isocpp.org Fri Mar 16 18:21:09 2018
Return-path: <std-proposals+bncBCEKFTV6ZUMBBAP3V7KQKGQESJF4IAI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f200.google.com ([209.85.217.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBAP3V7KQKGQESJF4IAI@isocpp.org>)
	id 1ewt2R-0001Si-Bd
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Mar 2018 18:21:07 +0100
Original-Received: by mail-ua0-f200.google.com with SMTP id t8sf2523627uaj.18
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Mar 2018 10:23:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to: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;
        bh=u6l3B/aO0E0GlqZRipns4grS+Onv1h+t4WmLupKM2Wc=;
        b=R7r6eUtWtvx80PyJQi3jpGPsjZjEERuY1HpII675yHOaq8aqYnCQm1ctJPnpCzb2yR
         cKrjyga87GSV1jMgatDgJr9hjdEV+73ApDn2TqQkxht/FJWx2tdHytAcjt8MPBIpfiLk
         zmagMWLjzlopaF9M262TfvOyjrDlShGDt0jfLPkFuSCjTp9niDcWB6rEojUoVxC+OOrT
         OxT12PgQTZPayYo4C/y4ObFmM2D8sT6iPw9urnoW0uo9uzVCHQ/17y2PvHMT6xhOWdBr
         saRBo1qFDc/s9DKa/+9Wf/BM4HTIWhdr7fkpzXw3JGj6OGOAZPyst8Wg6k6j7kixf6Dh
         /wfA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to: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;
        bh=u6l3B/aO0E0GlqZRipns4grS+Onv1h+t4WmLupKM2Wc=;
        b=phCfOD4dOsTNlfB2Hqs++lB6snUBuy031flLL4bQMwnLvylaHYpXg9h2Z0MbBaSP9G
         e5V2OdnAipN4WN5oi/pDRRy661snHulc+qiJ1V+lSSgqdHNEuRo+hnhk46XF+HwhmqoO
         9e11Dw7TWtH8X6/SlG9oAGI1gejJUsM3FhxBqvRXxu0mutKP5XSWFUyI8hlaOm5yo14w
         EcBgp/SWWB4Qht2eYx8tQD3QTqFYf/V6un0z1DJ26AJFZO+STp7IYhBXJyy0hw7IXhv6
         ICylh0qlbBpiOiS32VwUAILIn6U9suExKuonEK0lqt2STd4CVYVDLY86g0YLZNr6dPzw
         3UBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=u6l3B/aO0E0GlqZRipns4grS+Onv1h+t4WmLupKM2Wc=;
        b=UliXWP5+1hfvqfDbi4hCXxuccEhQtvS2RAwdqXHUfA27mRm/Q+4BgynRhz0ALQk+Zg
         Pf7dR77rHfcWftxgB7nZXt7QDjfbl3QqZyvh0RQYoVnS1CxNxjoX9p1q/AOfPsknzzx5
         aKfKNc9+WCBfuKo7b0sb7qtlaG4ZJdeayUfu9AC82UXdLP4eY8WZAgz4y6pQOxq6eDfT
         CmM+VL18uJqJWkOr0e8ROzHJryVOqw+hFiu8lWkdhI6LRpgYaIRhXUb1u4qiaDWIauvt
         FuQt+cZVEgJ6qCRYgVWvXTjJJPW5I0zilms86dr8cpAdCH9Tyj/lBwEo4CJfzrC3OkMn
         DZHg==
X-Gm-Message-State: AElRT7EHE0wAg8BN6/LCdltGFKjj5Gh20JGbm8N9OrXxWbKGQnePNKFM
	8bMiBnnJ6sjm5Nto7Pb6dL1h/w==
X-Google-Smtp-Source: AG47ELvTirwmL4HuCk5+TwDN4ThYbjZfnQPkt8e0x5KtjvWNeO85XGAJsBMGE//ow6ash1UnJ5ZvZQ==
X-Received: by 10.31.94.136 with SMTP id s130mr989476vkb.38.1521220993972;
        Fri, 16 Mar 2018 10:23:13 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.50.79 with SMTP id y76ls4094901vky.7.gmail; Fri, 16 Mar
 2018 10:23:12 -0700 (PDT)
X-Received: by 10.31.158.83 with SMTP id h80mr291429vke.9.1521220992673;
        Fri, 16 Mar 2018 10:23:12 -0700 (PDT)
In-Reply-To: <CAHSYqdZA9zarj3qL0otGwaQQU-g2Tkk7jEmWziFBWz=iYR2ANg@mail.gmail.com>
X-Original-Sender: jmckesson@gmail.com
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:37363
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37363>

------=_Part_1850_1285662006.1521220991948
Content-Type: multipart/alternative; 
	boundary="----=_Part_1851_1871515636.1521220991948"

------=_Part_1851_1871515636.1521220991948
Content-Type: text/plain; charset="UTF-8"

On Friday, March 16, 2018 at 11:34:02 AM UTC-4, Hyman Rosen wrote:
>
> On Fri, Mar 16, 2018 at 11:16 AM, Nicol Bolas <jmck...@gmail.com 
> <javascript:>> wrote:
>>
>> You just need to simultaneously modify C++ so that there is a built-in 
>>> equivalent
>>> to offsetof, and make offsetof a pre-defined macro that expands to that.
>>>
>>
>> And if modules can't export macros, how will `import std.cstddef` give me 
>> access to that module?
>>
>
> What module?  I don't understand.
>
> Let me try again:
>
>    - Change C++ so that there is a built-in version of offsetof under a 
>    different name, say __offsetof.
>    - __offsetof is available for use in all C++ code without any header 
>    or module needed, just as sizeof is.
>    - Also change C++ so that offsetof is a pre-defined macro that expands 
>    to __offsetof.
>
>
Oh, when you said "built-in" you meant like "supplied by the compiler".

So... what happens with people's code that *don't* include <cstddef> or 
<stddef> that happens to use the `offsetof` identifier? Admittedly this is 
a minor issue, as I rather doubt someone's going to make a class or 
function that conflicts with a fairly widely known C macro that gets 
included by quite a few things (even if only because of other useful 
things).

-- 
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/64578641-a89f-4b60-82ce-5183a54a3630%40isocpp.org.

------=_Part_1851_1871515636.1521220991948
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, March 16, 2018 at 11:34:02 AM UTC-4, Hyman Rose=
n wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>=
<div class=3D"gmail_quote">On Fri, Mar 16, 2018 at 11:16 AM, Nicol Bolas <s=
pan dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscate=
d-mailto=3D"BhLMGhjyAgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;=
javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;=
;return true;">jmck...@gmail.com</a>&gt;</span> wrote:<blockquote class=3D"=
gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><span><blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr"><div><div class=3D"gmail_quote"><div>You just need to simult=
aneously modify C++ so that there is a built-in equivalent<br>to offsetof, =
and make offsetof a pre-defined macro that expands to that.</div></div></di=
v></div></blockquote></span><div><br>And if modules can&#39;t export macros=
, how will `import std.cstddef` give me access to that module?</div></div><=
/blockquote><div><br>What module?=C2=A0 I don&#39;t understand.<br><br></di=
v></div></div></div></blockquote><blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>Let me try again:<=
br><ul><li>Change C++ so that there is a built-in version of <font face=3D"=
monospace, monospace">offsetof</font> under a different name, say <font fac=
e=3D"monospace, monospace">__offsetof</font>.</li><li><font face=3D"monospa=
ce, monospace">

<span style=3D"color:rgb(34,34,34);font-family:monospace,monospace;font-siz=
e:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:=
left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0p=
x;background-color:rgb(255,255,255);float:none;display:inline">__offsetof</=
span>=C2=A0</font>is available for use in all C++ code without any header o=
r module needed, just as <font face=3D"monospace, monospace">sizeof</font> =
is.</li><li>Also change C++ so that <font face=3D"monospace, monospace">off=
setof</font>=C2=A0is a pre-defined macro that expands to <font face=3D"mono=
space, monospace">

<span style=3D"color:rgb(34,34,34);font-family:monospace,monospace;font-siz=
e:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:=
left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0p=
x;background-color:rgb(255,255,255);float:none;display:inline">__offsetof</=
span></font>.</li></ul></div></div></div></div></blockquote><div><br>Oh, wh=
en you said &quot;built-in&quot; you meant like &quot;supplied by the compi=
ler&quot;.<br><br>So... what happens with people&#39;s code that <i>don&#39=
;t</i> include &lt;cstddef&gt; or &lt;stddef&gt; that happens to use the `o=
ffsetof` identifier? Admittedly this is a minor issue, as I rather doubt so=
meone&#39;s going to make a class or function that conflicts with a fairly =
widely known C macro that gets included by quite a few things (even if only=
 because of other useful things).<br></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/64578641-a89f-4b60-82ce-5183a54a3630%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/64578641-a89f-4b60-82ce-5183a54a3630=
%40isocpp.org</a>.<br />

------=_Part_1851_1871515636.1521220991948--

------=_Part_1850_1285662006.1521220991948--

.
