220 37338 <CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO+A7CMm9XBUC96g@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicolas Lesser <blitzrakete@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: `offsetof` in a macro-less, modular world
Date: Thu, 15 Mar 2018 17:21:05 +0000
Lines: 124
Approved: news@gmane.org
Message-ID: <CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO+A7CMm9XBUC96g@mail.gmail.com>
References: <c5f5ccc4-3267-442d-8cb2-de1ae103a38e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a1136e056204cc3056776b895"
X-Trace: blaine.gmane.org 1521134358 11015 195.159.176.226 (15 Mar 2018 17:19:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 15 Mar 2018 17:19:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDXKNLEUTADRBDWXVLKQKGQEDOJZZQA@isocpp.org Thu Mar 15 18:19:14 2018
Return-path: <std-proposals+bncBDXKNLEUTADRBDWXVLKQKGQEDOJZZQA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ot0-f197.google.com ([74.125.82.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDXKNLEUTADRBDWXVLKQKGQEDOJZZQA@isocpp.org>)
	id 1ewWX2-0002iK-Bl
	for gclcip-std-proposals@m.gmane.org; Thu, 15 Mar 2018 18:19:12 +0100
Original-Received: by mail-ot0-f197.google.com with SMTP id k18-v6sf3890581otj.10
        for <gclcip-std-proposals@m.gmane.org>; Thu, 15 Mar 2018 10:21:19 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1521134479; cv=pass;
        d=google.com; s=arc-20160816;
        b=xGos0JVm3EbUipDxbIQwwTXzwGju/teNRmfsIsFtvmq0nyllJQB9BfgmcwJZrr2yqB
         HBwF2BrGLuFgyktsCmIl3dDt0TjbZBs0pyQVWBg6oVQlhiNeHsZ40v9z7/lIa8MOE7jW
         eFyvo99Q3ARJrTBAVVnZ32K6OXETHwOU62RzGCXXtlod+D0kA6NnAcGWciFuI7eQM5qH
         AjSJw3Ii+CMiX41FQF4ccDJNj0hlqWLMt880Oh93Ipwi06MkwO+10VazjXpuf3HO8/qM
         N3sgFjW2famLO0ACKS8t0I+YSmQ0JlQ9UvrpQmLDRNBntRsuPRXkZpb1tF/nsr1MTa2+
         gz7w==
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:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=fQB+iMlO0rIWMVFZg4GNKruzC1p+m6bQSSETcKHSs+8=;
        b=ESqjLycTQpeIcPjKcMyTdy6Xuqf9A9LVnKKY6Pq3NBivXEX3EI2Sn7O8PXjVGuADwa
         KuYCKjYn1sdz9XVO12/1jeLcvRtevURcr73Ry66abJZuOJuiQxDYzeTqqjp0/V+oqmaw
         NZ4YT9zXr6JjTn+AaiHJx7R/PyUIL+ccWyow5ksEmmQccVrjHvZ9rfF3TM5JWzLmdiI2
         XMRlwc2aY3DczQGfRVAEdc9BzA5FUR8xcZqQ3Ijkpy3m6HxWZvLVq7YUypAEVKJW4nsw
         VBTg0EKO65jC9naCKG94ISQZjmyDTXDYSyF8HkHrTLs4waMJJNn+tj1ExPhkOg3wwJd8
         Fb3w==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1IzJj7b;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=blitzrakete@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:references:in-reply-to: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=fQB+iMlO0rIWMVFZg4GNKruzC1p+m6bQSSETcKHSs+8=;
        b=iehiA0fp0NLJmH56NtG6X96H3768ns3Efn2/fyfC+c0E8z1/ROC/VIwrzbnAxgpJL5
         fzqE/ANejLXdI7srDj7733lkwbRBB471zB3c+50VLmtpePvSv607DT21ZAL8V11HcaVD
         CcL+olJYqfeSmLmUc1GQhxW8Znps7GkJ1Tp1aDF//rcRE9tPYfUGPEsxaqLe/2o5kfcf
         CLFEoFUXDuHrHpN7UmKJJl5/p7+A8bQGiw2iFLwT4UfoVDqreNisbFzF9iQovliNXIqr
         pKnAV8qd04df1DOqvbaGI1AcxzfhHk5jucTaHzNAbC2s2FFy6z75E3GHf2s0STPB9PIc
         VKQg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to: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=fQB+iMlO0rIWMVFZg4GNKruzC1p+m6bQSSETcKHSs+8=;
        b=XZT5GkzTqEBH7xK0aXkWxNTCGRZTeWsSrQ26NWFbki51k+HDQodTp4t3FyqYwN+Fwi
         RrBpAE1Zu7HRsDcXpqbpcWrRe4/XfM1yyNcVBrLNob5nDLoxsIWm583m8P7frBYFP18o
         ro5VZgko5lnSNUk4objjPFRt3uZBWEeoznLWsW7HbpCgD4msQh9EuFl3MYbjGBg9tW2O
         mVpmC0ciG9iov8JaqFWhnE6htrSdvX1yEop/IgGHei9crGDmJAIO+0eIeg2mpxIgxF2g
         D6nfXymeuD9dS8XFTdDfFgIxKY2cCQVP4Jpy3sgGO7h9VpgVN1rgu5H/t6qmDYGPr4vv
         r0lw==
X-Gm-Message-State: AElRT7HJRbzX80ZF9VjZzE2D16BeSGkMF6lZDhLOPYKxUB8avDRS9BDv
	Bc12neQT+Onb3Mj4MHzlcOUYFA==
X-Google-Smtp-Source: AG47ELtq6i/JoCkeu9ur+tOjmiczDqgVK/EaCauF9PuZ3ADpdeAiv5S/TjVW8fNUESqMq2LTygFinw==
X-Received: by 10.157.67.118 with SMTP id y51mr4111004oti.34.1521134479245;
        Thu, 15 Mar 2018 10:21:19 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.202.231.17 with SMTP id e17ls624600oih.2.gmail; Thu, 15 Mar
 2018 10:21:16 -0700 (PDT)
X-Received: by 10.202.25.14 with SMTP id l14mr5942971oii.116.1521134476909;
        Thu, 15 Mar 2018 10:21:16 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1521134476; cv=none;
        d=google.com; s=arc-20160816;
        b=x2Cki72y2C6WZlWks+r3an3CIW/3Un7zu/bxeQQxsOul2FGRnUe9mFymurqjqzm1bI
         pf0TF4HVanItT9tQSVNC7Z9juLSnCBCD893UvVn2Em3Y3t370I1Exm2xBkz7nHZCMSyt
         fMExt/69CsNqM9KjMF1MlSIooYi/bMDbgxFDKrB9pS/j6xQINg3dV6sg4ohrKZFUvYE8
         5uHddy9S23uafQXKwg5XCn7QlBXSBSzChBS2mlyG4A6szFhuIvlC3Ra2hHetxlW8277i
         XajMMZKtIvq6Tq4Hgzw7hNJtjKNvoGHlsjG6ljNqAFVEUTtO2n5t3JwGV6uQTIkZ1+rW
         LhRw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=i4I+9OUfrKwHaoRD0Briic0gMHqczfTdcUjy1sMt3kk=;
        b=TuWXBNuJrbf6ihAaEpKYn9Q1DA+PA0LDqlD10lvVMda6um0/GZeYdNbEO0g4BccBel
         PFPU8vnAt762vmfEZT6R6Zlkb+MZrZm2s+SwuvhqQpATXYPK6+vv+1BGUM/xV5nlXUyW
         pWSw0+Vop0qINHZ6qxatd8SuDSEnvBvaKtn/qkvdxtak5TjXlXJv75S/9VvZ8YLw/GJe
         Ndir2CIeze6Ogd2MOUO7cm9U4D/Hz40Ub2jd+wP/li0RKVUev9YceuEaiivS8g71U4zG
         OtPch7WzmXtcR4qPUJITr3uTMwgiSJX703H3PO7DgcpkgprcQIYCFP7cujBZ6e/ZQk1v
         O6vg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1IzJj7b;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=blitzrakete@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id v9sor898756otv.268.2018.03.15.10.21.16
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 15 Mar 2018 10:21:16 -0700 (PDT)
Received-SPF: pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.157.19.92 with SMTP id q28mr5871600otq.69.1521134476478;
 Thu, 15 Mar 2018 10:21:16 -0700 (PDT)
In-Reply-To: <c5f5ccc4-3267-442d-8cb2-de1ae103a38e@isocpp.org>
X-Original-Sender: blitzrakete@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=T1IzJj7b;       spf=pass
 (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=blitzrakete@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:37338
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37338>

--001a1136e056204cc3056776b895
Content-Type: text/plain; charset="UTF-8"

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 <jmckesson@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-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/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/CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO%2BA7CMm9XBUC96g%40mail.gmail.com.

--001a1136e056204cc3056776b895
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Not that I know of. This was mentioned in passing while d=
iscussing 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 ma=
king offsetof an operator would mean incompatibilities with POSIX headers b=
ut better for modules.</div><div dir=3D"auto"><br></div><div dir=3D"auto">Y=
ou might want to write a proposal for this.</div><div dir=3D"auto"><br></di=
v><div dir=3D"auto">There is the Atom proposal which proposes to have a &qu=
ot;module header&quot; which can also solve this issue in a relatively clea=
n way (P0947).</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">O=
n Thu, Mar 15, 2018, 12:12 PM Nicol Bolas &lt;<a href=3D"mailto:jmckesson@g=
mail.com" rel=3D"noreferrer noreferrer" target=3D"_blank">jmckesson@gmail.c=
om</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=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, 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 t=
he C macros, which allows us to still work with them in a modular standard =
library that doesn&#39;t allow macros.<br><br>`offsetof` is a special case =
because it&#39;s not a function. Or at least, it&#39;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 replac=
ements 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++ replacement =
for `offsetof`. As modules moves forward, are there plans to resolve this i=
ssue and similar ones (beside the &quot;let&#39;s get modules to export mac=
ros&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>
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" rel=3D"nore=
ferrer noreferrer noreferrer" target=3D"_blank">std-proposals+unsubscribe@i=
socpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" rel=3D"noreferrer noreferrer noreferrer" target=3D"_blank">std-propos=
als@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/c5f5ccc4-3267-442d-8cb2-de1ae103a38e%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"noreferrer =
noreferrer noreferrer" target=3D"_blank">https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c5f5ccc4-3267-442d-8cb2-de1ae103a38e%40isocpp.or=
g</a>.<br>
</blockquote></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/CALmDwq38-kBPK2QnEPLkzM9z7r_jXif7oBoO=
%2BA7CMm9XBUC96g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq38-kBPK2=
QnEPLkzM9z7r_jXif7oBoO%2BA7CMm9XBUC96g%40mail.gmail.com</a>.<br />

--001a1136e056204cc3056776b895--

.
