220 37371 <d9e85fb4-6296-44ee-81f8-7b8fdbc8822e@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: inkwizytoryankes@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: `offsetof` in a macro-less, modular world
Date: Fri, 16 Mar 2018 15:02:16 -0700 (PDT)
Lines: 137
Approved: news@gmane.org
Message-ID: <d9e85fb4-6296-44ee-81f8-7b8fdbc8822e@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>
 <64578641-a89f-4b60-82ce-5183a54a3630@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2696_401175840.1521237736111"
X-Trace: blaine.gmane.org 1521237615 31464 195.159.176.226 (16 Mar 2018 22:00:15 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Mar 2018 22:00:15 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDDLTAGNTIBBB2P5WDKQKGQE4ATEV4Q@isocpp.org Fri Mar 16 23:00:11 2018
Return-path: <std-proposals+bncBDDLTAGNTIBBB2P5WDKQKGQE4ATEV4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f69.google.com ([209.85.213.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDDLTAGNTIBBB2P5WDKQKGQE4ATEV4Q@isocpp.org>)
	id 1ewxOV-00087Q-FF
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Mar 2018 23:00:11 +0100
Original-Received: by mail-vk0-f69.google.com with SMTP id x140sf7141160vkx.17
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Mar 2018 15:02:18 -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=zO2CSJU7yiWbmXaKCfgZBmsh5vBkXhkMzADAk5RmTNI=;
        b=tW59AvZ0JadPHgGK6vHAHci/ijfSSeezLN+Kzckq09u1AmkRSkFs7XT//P0KT73bBH
         B0JmSE7zHjKUYyfhsJMZggz1GkxTB2GxAnNuM8OYk5SoE2PE+rH4mgYoaOpA8RWnJoud
         epvm7UQwol2aOcymQ4sqfkzZzaoxD2XZwVQYrsWUwwmN3Ec5tI9ed5Yj36jBXS6Gknit
         f2qES+48fwl7y5Vrsfr2ru/5Otq1UBsY85f5M13aiHpLg99hrME7l4NSfrGzJ95CyfI3
         6NGekzU75MQ5b0LdPoqH4tHFyxSw6Dj3SeNzVTg1vOcCYS85bzx7uWFlkux4Vm1gQeWw
         kGhQ==
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=zO2CSJU7yiWbmXaKCfgZBmsh5vBkXhkMzADAk5RmTNI=;
        b=R/cM/5TIx8AS1lJLkoDsBdjgjFIqysSFke8Xwm+S1MeOuBlzYBqW+Iv63bfPN8FBDS
         4HXPa4d8fbV9SEk8dXenZsXWrId6TZek/4K92NHgvxrwgB/XW/UN7ilX8HSZelYyfWdk
         l4KS+8p1ZR2oCJCAc1QyL5T7XdmtxZlzBgKdUL+c/CQkt6k8OoOP5NWl5kgo+BVC9rTa
         9duiosr44LML1lBwOZ/stzt5MJ9CNqshuVM9CACJvDeZhExnFUPwrg5iMiI6yv32rsUi
         HEXTpfH0wywRu6jGfknpSaLqOOwwE8KyBkFiP7AxAADG1NZfg9Jmf4buQEn/bswPcwP0
         G2iQ==
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=zO2CSJU7yiWbmXaKCfgZBmsh5vBkXhkMzADAk5RmTNI=;
        b=YghmO+urKK7HoKfY8b4h35G3even0MInbzYtcGZe21OFgsSanzkqZvU4XwiQsvZIrh
         WLuzfmA2YStesBY4IgpeORkqjDPVYvSdOa/vySniza7ZJvresD2BhM9cbisP8hMI0Nmp
         UrlJW8LO/Zv2L9x7SOFLP9BLKiOIKVi4mQyPH688ka5crjDreQ08znn5tXMUkUUjd4Kg
         p8TY/bdlAXG78hRKpEg5OqrqYzdO1O8PQ0zLfX9MNq/vVbdRb9dHQcoX/GnbrWNVH3g0
         ZvMhNfi76Vw6YaV9BWGFpoZtSTsegoGN9mCeUQf1UNFF3zcsELGdQV7pKkOs8n1cuXkq
         /3Og==
X-Gm-Message-State: AElRT7HfS/OtmX7WzfZop//lDNEi2Yw+iJC+/dyJky7X7umTtLG9hUoY
	vfkQkr6tGeyTsJ8gngHQ9qjI0Q==
X-Google-Smtp-Source: AG47ELsym0vjjmxL+c8CiFSHYI1JJILexTEe3gYU1OIQX0g3voTMuokvr+1PREnyS3G5FI4017uWLA==
X-Received: by 10.176.72.131 with SMTP id x3mr1472926uac.58.1521237738373;
        Fri, 16 Mar 2018 15:02:18 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.148.12 with SMTP id w12ls4463773vkd.1.gmail; Fri, 16 Mar
 2018 15:02:17 -0700 (PDT)
X-Received: by 10.31.158.83 with SMTP id h80mr394250vke.9.1521237736948;
        Fri, 16 Mar 2018 15:02:16 -0700 (PDT)
In-Reply-To: <64578641-a89f-4b60-82ce-5183a54a3630@isocpp.org>
X-Original-Sender: inkwizytoryankes@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:37371
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37371>

------=_Part_2696_401175840.1521237736111
Content-Type: multipart/alternative; 
	boundary="----=_Part_2697_1190768618.1521237736112"

------=_Part_2697_1190768618.1521237736112
Content-Type: text/plain; charset="UTF-8"



On Friday, March 16, 2018 at 6:23:12 PM UTC+1, Nicol Bolas wrote:
>
> 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> 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).
>

People who use  `<cstddef>` will still use `<cstddef>` we don not change 
antything (this why I suggest leaving it alone).
We add new keyword `real_super_offsetof` that will be available everywhere.
Only problem would be migration of heder to modules usage but because 
offsetof is macro we can safely use text replace to change it to new 
keyword.

-- 
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/d9e85fb4-6296-44ee-81f8-7b8fdbc8822e%40isocpp.org.

------=_Part_2697_1190768618.1521237736112
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, March 16, 2018 at 6:23:12 PM UTC+1, Nic=
ol Bolas 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=
">On Friday, March 16, 2018 at 11:34:02 AM UTC-4, Hyman Rosen wrote:<blockq=
uote 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 <span dir=3D"ltr">&lt;=
<a rel=3D"nofollow">jmck...@gmail.com</a>&gt;</span> wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><span><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>You just need to s=
imultaneously modify C++ so that there is a built-in equivalent<br>to offse=
tof, and make offsetof a pre-defined macro that expands to that.</div></div=
></div></div></blockquote></span><div><br>And if modules can&#39;t export m=
acros, 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=
></div></div></div></div></blockquote><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><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></blockquote><div><br>Peop=
le who use=C2=A0 `&lt;cstddef&gt;` will still use `&lt;cstddef&gt;` we don =
not change antything (this why I suggest leaving it alone).<br>We add new k=
eyword `real_super_offsetof` that will be available everywhere.<br>Only pro=
blem would be migration of heder to modules usage but because offsetof is m=
acro we can safely use text replace to change it to new keyword.<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/d9e85fb4-6296-44ee-81f8-7b8fdbc8822e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d9e85fb4-6296-44ee-81f8-7b8fdbc8822e=
%40isocpp.org</a>.<br />

------=_Part_2697_1190768618.1521237736112--

------=_Part_2696_401175840.1521237736111--

.
