220 37340 <CAANG=kUKSnNQ=dcKB-oeDdap7ydGNUy4dM9p4LOBZCrLdGL=Uw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: `offsetof` in a macro-less, modular world
Date: Thu, 15 Mar 2018 18:10:39 +0000
Lines: 173
Approved: news@gmane.org
Message-ID: <CAANG=kUKSnNQ=dcKB-oeDdap7ydGNUy4dM9p4LOBZCrLdGL=Uw@mail.gmail.com>
References: <c5f5ccc4-3267-442d-8cb2-de1ae103a38e@isocpp.org>
 <CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO+A7CMm9XBUC96g@mail.gmail.com> <e7a864e9-a866-40d6-9688-95219dc34d92@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000efb9fa0567776971"
X-Trace: blaine.gmane.org 1521137339 28077 195.159.176.226 (15 Mar 2018 18:08:59 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 15 Mar 2018 18:08:59 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDRYVJ6TVYBRBNHOVLKQKGQEA7C3YPY@isocpp.org Thu Mar 15 19:08:55 2018
Return-path: <std-proposals+bncBDRYVJ6TVYBRBNHOVLKQKGQEA7C3YPY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f200.google.com ([209.85.192.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDRYVJ6TVYBRBNHOVLKQKGQEA7C3YPY@isocpp.org>)
	id 1ewXJ9-0007Cg-7s
	for gclcip-std-proposals@m.gmane.org; Thu, 15 Mar 2018 19:08:55 +0100
Original-Received: by mail-pf0-f200.google.com with SMTP id s25sf3598132pfh.9
        for <gclcip-std-proposals@m.gmane.org>; Thu, 15 Mar 2018 11:11:02 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1521137461; cv=pass;
        d=google.com; s=arc-20160816;
        b=RVeQw7DnRcmBJrBETtYyQRUFqGYAkU7k0d8TdBf3U4BIbgj57Xb6QdpEmLv6Ui7J6z
         un151yS+ppKqODGCyj0CpeGc1y8SbxGNwIcctpWvpFDCu8XtjZXVNWY7EdW8B6tr20Rt
         +XZgBM1WFe5ma/Fst3lj5EKQAX75MAxfsaRBVonLH5i6z8R+cmiaE0izHvC4s1z781UP
         XK47Tk8mDPgQyTAtyhetwATu/jBVEBVHdjfbvMJYEgXJwfmpCVozWr6ThMEZ6Lt5oIXn
         gmW76zetQsoxnIy5yGKnl6D4zhVk7sgMPfwV6C6URJVmqqJ0sv8gnIaWLnqYcNRN1rBZ
         RREQ==
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:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=HfK9UrMV4FRB//z7YidzPtxBjFMH66KdRTRJiex76/Q=;
        b=YZposNX7vwLpxhkhAzRA97eiQbeh9oMcb7rA2zfQA7WyGxFChAOv3hnHyT2SW/3VvH
         IdKh8bk9eGHIAp1m9YOTSydiqFX/CH2sINDTpOM2JcKUD0vOgh230loJ/eMetbXAL6DY
         tlzhazGDsS1wUL/0ipReswJqfQ6B+EQJWFaOX3hf0LRp0yuag8hdu7NvgdiATWl7Z7ZI
         vRg2Ks8hiSXWfc6OMAVjjLdPQji1Nn6g98qFAIARzc2SR8mlpLBBO3qzePowyHX5EflV
         k9VZKiCNObqydMecLWPxcn6/xPC7A/iozANhj0aGSS91bAjhfqlbVYkUUUjGJixUQceJ
         8Rxg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=RyvrW8ii;
       spf=pass (google.com: domain of gasper.azman@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=gasper.azman@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject: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;
        bh=HfK9UrMV4FRB//z7YidzPtxBjFMH66KdRTRJiex76/Q=;
        b=I3obcxXX7gkz5ZSMUsQz5JONR3ldR8WCUUQSI/cwVCw6gAMtO396PqT0/SHSDJ6dgE
         bPVQkrc+RP2QfZzS+nYJmUUCkzzthwlgQczT+SssTwzATpSjewIxl/IerD8OPonOF7kA
         me9w31w59J9PJ8q9b09az1GXcfswlm8a42ZCDfkdb5Zo3SevS9FZMgHBdvYtBeFfc0Dg
         bLvgnIFaNgfRnNbX7L1TKI8mSkk2TQQj7EBpGs8JlDhtOBrhkiDBuJuuyQttn/Sr71xy
         uSXaICZBnQHsSGueQuiiZKJx5tp1iE1456nFidiz3vu/mcYS0fWHJS5IlAwCbmACZ+bA
         KvOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to: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=HfK9UrMV4FRB//z7YidzPtxBjFMH66KdRTRJiex76/Q=;
        b=rr7thdlNVfbx9KkYEfkR8BkBsN1DV1Ny8GvTvns2XhQf8c96iNO9JOnW0OD17o2007
         1fi37q9td0l4lTT93RlC+suMcHlUza5GnctouycY/A1V5l0Vy1L7fvUuTr0DJOh8Z5kW
         JO9/u/B0RnwrsVFa9TAHGzb36wPI10eclwMOkiLXJHSID0jLk+afIWsJdNPhIG4zzhQp
         EzlrzDOIHrI6ph/MGoJKkv74N6/OdlIQL6eGGc4BTkBZOqXy5rshQObA8n1rv/E4F5qT
         1DSWozSM+/oACZ6H98TCAmOOjZxuvL+TarNaA52iigpFbHS0icxklCCqoLzFcKqXveTX
         4zNg==
X-Gm-Message-State: AElRT7G/LjPeNRRnCGh6y0s3DBwQtmttekmRcWwxzqu95Qba5uKv+/k8
	t7tFzc1lVfdWNKDtb4wZfBTJXA==
X-Google-Smtp-Source: AG47ELtzZtQDwrKFVM1QuGzr5Tk7KeJMciO43IDDk9oAM5V3HpHMcrjRVbbkoFUInyW1kGkQkYtJ4w==
X-Received: by 2002:a17:902:ac82:: with SMTP id h2-v6mr2278203plr.19.1521137461480;
        Thu, 15 Mar 2018 11:11:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a17:902:8a91:: with SMTP id p17-v6ls2043783plo.3.gmail; Thu,
 15 Mar 2018 11:11:00 -0700 (PDT)
X-Received: by 2002:a17:902:76c9:: with SMTP id j9-v6mr9146652plt.250.1521137460057;
        Thu, 15 Mar 2018 11:11:00 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1521137460; cv=none;
        d=google.com; s=arc-20160816;
        b=Tkoair6MT26j61F9GyfV9B7HLlivBo0bBPNv2sPDpbsKCnW0b2UbfX66gBSnVZxFc1
         OF12CLFVCjekovw9MJ5AiXpYk1NBjByeZ/RdLPdbIk15hkXmtKzef3Qx9PX/zESg/IkL
         8I3im0uXDaRF1ga8+pj2wTLF8U11o55YRvCSWOGH4SEMKdgCE0S13UK0IM69OcrLDOvu
         kD+KG8YQWo2I+WXesfRlQ0glXEjNHrIAlT7Ehp6WhycBBuK5zpfOBXkSPgxVHE1bYZ8g
         fAi3lP11RL6UXsu1KBMnx+yNW011CGPxdmMvdKjUvXanaH1v6/fIvoNrNAicI83T3/0K
         9fpg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=Zxl/OObGAZ/xfYCctO5+7K1kv78uZ3Ahuiwp+7cuWWM=;
        b=SyDW+EG2ioBgLiarhTfxXBZTMTcoeJolL6ECS7M1B5yKmzTSKpjzGJRBfxzOURjDgS
         l5g5rMhDPbq4XkV89HEoUfJ70pbI2SZW2dK6Rp1o56dnupgt09++dYl8bTtTamARuc7c
         dk/+z6eRoBMAyr/gEsGr688pgF5L1pkBVmcpyA6YCgKoqu81xOtv122K+Gas4P8HJ2rb
         kKkcbMoVoXy6Dk2BmznV1cMlZx5NGktr8k+QmU0B9bBskNN/AaiTEax+SRWMJRwzKqRu
         tuOPAbyRFHn4KPBhyvK8UXBevSmHb2eW2SYUFSkORhhakedpP3LnAko9tXn5DOWDgavN
         7ouQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=RyvrW8ii;
       spf=pass (google.com: domain of gasper.azman@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=gasper.azman@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65])
        by mx.google.com with SMTPS id k33-v6sor1875827pld.14.2018.03.15.11.11.00
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 15 Mar 2018 11:11:00 -0700 (PDT)
Received-SPF: pass (google.com: domain of gasper.azman@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65;
X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr9266881pls.353.1521137459639;
 Thu, 15 Mar 2018 11:10:59 -0700 (PDT)
Original-Received: by 10.236.133.141 with HTTP; Thu, 15 Mar 2018 11:10:39 -0700 (PDT)
In-Reply-To: <e7a864e9-a866-40d6-9688-95219dc34d92@isocpp.org>
X-Original-Sender: gasper.azman@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=RyvrW8ii;       spf=pass
 (google.com: domain of gasper.azman@gmail.com designates 209.85.220.65 as
 permitted sender) smtp.mailfrom=gasper.azman@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE 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-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:37340
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37340>

--000000000000efb9fa0567776971
Content-Type: text/plain; charset="UTF-8"

ooo offsetof that works on members of virtual base classes :)

On Thu, Mar 15, 2018 at 6:09 PM, <inkwizytoryankes@gmail.com> wrote:

> I think we should leave this macro alone and add new operator with
> different name that will be available everywhere.
> And then optionally define `offsetof ` with use this new operator.
>
> On Thursday, March 15, 2018 at 6:21:19 PM UTC+1, Nicolas Lesser wrote:
>>
>> Not that I know of. This was mentioned in passing while discussing P0908,
>> where it was suggested to make it an operator.
>>
>> EWG then went back and forth a bit, as making offsetof an operator would
>> mean incompatibilities with POSIX headers but better for modules.
>>
>> You might want to write a proposal for this.
>>
>> There is the Atom proposal which proposes to have a "module header" which
>> can also solve this issue in a relatively clean way (P0947).
>>
>> On Thu, Mar 15, 2018, 12:12 PM Nicol Bolas <jmck...@gmail.com> wrote:
>>
>>> The C standard library defines a large number of things that are macros.
>>> In the vast majority of cases, these are constants or functions, which can
>>> in C++ code be converted into `constexpr` variables or actual functions.
>>> For all intents and purposes, such constructs can be drop-in replacements
>>> for the C macros, which allows us to still work with them in a modular
>>> standard library that doesn't allow macros.
>>>
>>> `offsetof` is a special case because it's not a function. Or at least,
>>> it's not a function that C++ at present allows you to write. Without
>>> reflection, there is no way to pass a typename or member variable as a
>>> function parameter. And while there are ways we can work around it, none of
>>> those ways would be drop-in replacements for `offsetof`; the user would
>>> have to change their code.
>>>
>>> And even ignoring the non-drop-in part, there is currently no C++
>>> replacement for `offsetof`. As modules moves forward, are there plans to
>>> resolve this issue and similar ones (beside the "let's get modules to
>>> export macros" plan)?
>>>
>>> --
>>> 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-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit https://groups.google.com/a/is
>>> ocpp.org/d/msgid/std-proposals/c5f5ccc4-3267-442d-8cb2-
>>> de1ae103a38e%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c5f5ccc4-3267-442d-8cb2-de1ae103a38e%40isocpp.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/e7a864e9-a866-40d6-
> 9688-95219dc34d92%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e7a864e9-a866-40d6-9688-95219dc34d92%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAANG%3DkUKSnNQ%3DdcKB-oeDdap7ydGNUy4dM9p4LOBZCrLdGL%3DUw%40mail.gmail.com.

--000000000000efb9fa0567776971
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">ooo offsetof that works on members of virtual base classes=
 :)</div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Thu, =
Mar 15, 2018 at 6:09 PM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:inkwizyto=
ryankes@gmail.com" target=3D"_blank">inkwizytoryankes@gmail.com</a>&gt;</sp=
an> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I think we sh=
ould leave this macro alone and add new operator with different name that w=
ill be available everywhere.<br>And then optionally define `offsetof ` with=
 use this new operator.<span class=3D""><br><br>On Thursday, March 15, 2018=
 at 6:21:19 PM UTC+1, Nicolas Lesser wrote:</span><blockquote class=3D"gmai=
l_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><span class=3D""><div dir=3D"auto">Not that I know of. This =
was mentioned in passing while discussing P0908, where it was suggested to =
make it an operator.<div dir=3D"auto"><br></div><div dir=3D"auto">EWG then =
went back and forth a bit, as making offsetof an operator would mean incomp=
atibilities with POSIX headers but better for modules.</div><div dir=3D"aut=
o"><br></div><div dir=3D"auto">You might want to write a proposal for this.=
</div><div dir=3D"auto"><br></div><div dir=3D"auto">There is the Atom propo=
sal which proposes to have a &quot;module header&quot; which can also solve=
 this issue in a relatively clean way (P0947).</div></div><br></span><div c=
lass=3D"gmail_quote"><span class=3D""><div dir=3D"ltr">On Thu, Mar 15, 2018=
, 12:12 PM Nicol Bolas &lt;<a rel=3D"nofollow">jmck...@gmail.com</a>&gt; wr=
ote:<br></div></span><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=3D""><div d=
ir=3D"ltr">The C standard library defines a large number of things that are=
 macros. In the vast majority of cases, these are constants or functions, w=
hich can in C++ code be converted into `constexpr` variables or actual func=
tions. For all intents and purposes, such constructs can be drop-in replace=
ments for the C macros, which allows us to still work with them in a modula=
r standard library that doesn&#39;t allow macros.<br><br>`offsetof` is a sp=
ecial case because it&#39;s not a function. Or at least, it&#39;s not a fun=
ction that C++ at present allows you to write. Without reflection, there is=
 no way to pass a typename or member variable as a function parameter. And =
while there are ways we can work around it, none of those ways would be dro=
p-in replacements for `offsetof`; the user would have to change their code.=
<br><br>And even ignoring the non-drop-in part, there is currently no C++ r=
eplacement for `offsetof`. As modules moves forward, are there plans to res=
olve this issue and similar ones (beside the &quot;let&#39;s get modules to=
 export macros&quot; plan)?<br></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></span>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<span class=3D""><br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c5f5ccc4-3267-442d-8cb2-de1ae103a38e%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/c5f5ccc4-3267-442d-8cb2-<wbr>de1ae103a38e%40isocpp.org</a>.<br=
>
</span></blockquote></div>
</blockquote></div><span class=3D"">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e7a864e9-a866-40d6-9688-95219dc34d92%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/e7a8=
64e9-a866-40d6-<wbr>9688-95219dc34d92%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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/CAANG%3DkUKSnNQ%3DdcKB-oeDdap7ydGNUy4=
dM9p4LOBZCrLdGL%3DUw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkUK=
SnNQ%3DdcKB-oeDdap7ydGNUy4dM9p4LOBZCrLdGL%3DUw%40mail.gmail.com</a>.<br />

--000000000000efb9fa0567776971--

.
