220 31802 <CAF3xnJRtyCRSqc5dh7fpf1pSQem_Lw4SbePQxY3dBC_xEEisEg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Alberto Barbati <albertobarbati@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: This variable should not be named: an identifier
 (not) to remember
Date: Tue, 28 Mar 2017 11:09:54 +0200
Lines: 166
Approved: news@gmane.org
Message-ID: <CAF3xnJRtyCRSqc5dh7fpf1pSQem_Lw4SbePQxY3dBC_xEEisEg@mail.gmail.com>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <6096248.pKJ4QPQkKS@tjmaciei-mobl1> <4E0805FE-B97D-4A93-956D-9281B3207F39@gmail.com>
 <3421677.yAxhhm3ryH@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a114e5364ba3ed3054bc6d233
X-Trace: blaine.gmane.org 1490692207 26837 195.159.176.226 (28 Mar 2017 09:10:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 28 Mar 2017 09:10:07 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCPY5DV6RIMBBY6Q5DDAKGQEPWMM7TY@isocpp.org Tue Mar 28 11:10:03 2017
Return-path: <std-proposals+bncBCPY5DV6RIMBBY6Q5DDAKGQEPWMM7TY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f71.google.com ([74.125.83.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPY5DV6RIMBBY6Q5DDAKGQEPWMM7TY@isocpp.org>)
	id 1csn8Q-0005MN-IK
	for gclcip-std-proposals@m.gmane.org; Tue, 28 Mar 2017 11:09:50 +0200
Original-Received: by mail-pg0-f71.google.com with SMTP id n5sf96762870pgd.19
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 Mar 2017 02:09:56 -0700 (PDT)
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:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=Vm23YswxiExz9ZtlycZ0L2BNe3QLlUZ7z5imGZkwnG4=;
        b=NxQnfmUj58dhfYd71kBVbHHZfjyEID8Il1eRE9JH/GFvltoZvJHUsKemFEMMvmr6RZ
         YlxvoJZaYlKexu5J/J3M6J/lK0YqJ2/Mkxsj8/FJquT7ruUlYmZL6CK9MgdBwNVrqVAv
         Xj66IEJBkATKtiY0xxjoxFcokUgi0TLW0jJEQb0Tmd19BxQQCjyaZeCY5Dilk8F9XHIM
         juE0UMeIaCuOe3a31zePXs0gd/2yqkJbesdAbslk+S5PLFdSGbtaeOe3aF+yZ1cfclwj
         OsZM5BtUnsm/8E6bhWoWQ/eBKVL736uZgpXBWiIsX/gVK71igPp6rU9H4K1t5uOlzEIa
         ItrQ==
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=Vm23YswxiExz9ZtlycZ0L2BNe3QLlUZ7z5imGZkwnG4=;
        b=KEcbyB+E9pzuataIqX9rj7lyZZZRwhN9WfB2PfSWlQNhlOh5S6Bqk3XJOXDdcQp95P
         riNQPuu46YYg2ozI0IKCTgpXcbozJtfrMG46gON4meCvs4+m9V+pV0B7hLkYLgWPSpzJ
         kVJJMT48XecxPjykXH7y1YzzNTdnPiTG9I2fYrnUIa9SLxNud1MuhPhORB5csHFlgPcL
         IldVXpz2Du8JcKR7ZCenQJZE/LxJ6k1cHx7cBTmA6bdOTK3bVG8osenB3sJY3W1kFFd1
         6DrT1DrSS38CStRmGkRPGrBtoSrObxzTbjdBZKactW2/SCjB5IL08qz99eX+4r9cmjZ4
         te4g==
X-Gm-Message-State: AFeK/H3P6PHpEqDQA2h1EINu9JRKeJotUSa5uB5I97dAss/fKexkUhw+x6E3UobfftCZ3g==
X-Received: by 10.99.188.2 with SMTP id q2mr9720343pge.36.1490692196350;
        Tue, 28 Mar 2017 02:09:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.56.80 with SMTP id r16ls2120263otd.15.gmail; Tue, 28 Mar
 2017 02:09:55 -0700 (PDT)
X-Received: by 10.176.2.9 with SMTP id 9mr381466uas.155.1490692195189;
        Tue, 28 Mar 2017 02:09:55 -0700 (PDT)
Original-Received: from mail-vk0-x244.google.com (mail-vk0-x244.google.com. [2607:f8b0:400c:c05::244])
        by mx.google.com with ESMTPS id f139si1436771vkd.180.2017.03.28.02.09.55
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 28 Mar 2017 02:09:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of albertobarbati@gmail.com designates 2607:f8b0:400c:c05::244 as permitted sender) client-ip=2607:f8b0:400c:c05::244;
Original-Received: by mail-vk0-x244.google.com with SMTP id d188so11931717vka.3
        for <std-proposals@isocpp.org>; Tue, 28 Mar 2017 02:09:55 -0700 (PDT)
X-Received: by 10.31.88.1 with SMTP id m1mr1670904vkb.140.1490692194580; Tue,
 28 Mar 2017 02:09:54 -0700 (PDT)
Original-Received: by 10.176.74.93 with HTTP; Tue, 28 Mar 2017 02:09:54 -0700 (PDT)
In-Reply-To: <3421677.yAxhhm3ryH@tjmaciei-mobl1>
X-Original-Sender: AlbertoBarbati@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 albertobarbati@gmail.com designates 2607:f8b0:400c:c05::244 as permitted
 sender) smtp.mailfrom=albertobarbati@gmail.com;       dmarc=pass (p=NONE
 sp=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: <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:31802
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31802>

--001a114e5364ba3ed3054bc6d233
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

2017-03-28 9:04 GMT+02:00 Thiago Macieira <thiago@macieira.org>:

> Em segunda-feira, 27 de mar=C3=A7o de 2017, =C3=A0s 23:47:55 PDT, Alberto=
 Barbati
> escreveu:
> > > And yet it's in use.
> > > https://github.com/v8/v8/blob/master/src/x64/codegen-x64.cc#L33
> >
> > Thanks Thiago for the pointer. According to my (possibly incorrect)
> > interpretation this code raises undefined behavior because __ is reserv=
ed
> > "for any use", which I would expect includes the use as a macro name. I
> may
> > be wrong, but I'd expect little sympathy in the committee about
> potentially
> > breaking it. By the way, this code might possibly not break, because th=
ey
> > were clever to put #undefs in it. Incidentally, the code would indeed
> break
> > if we defined __ to be a macro...
>
> Right. We can say it's V8's own fault for using a reserved identifier. It=
's
> like when Qt (qlalr) had an identifier called _Nullable, but that got
> repurposed by a recent Clang change.
>

In this particular instance, V8's programmer could and probably should have
used a non-reserved name (for example "m_" would have been a better choice
regardless). Even the choice of _Nullable was ill-conceived, since
identifiers beginning with an underscore and an uppercase letter are also
reserved.


> I'm just saying it's known to be in use in a fairly major project. You
> know,
> the one that is behind Node.js and a whole ecosystem. The argument in the
> paper that says it's little used is incorrect: it's not like pre-C++11
> "auto",
> which had exactly one use in the entire Microsoft source code.
>

I said that it's little used in the two librariesI have checked (VS2015 and
libc++). For user code such as this, all I said is that "the proposal
should not break code", which is correct: the identifier __ should not have
been used in the first place, so this is a case of code that someone might
say "deserves to be broken".


> I guess we could convince GCC and Clang to print a warning about it if it
> looks like this is going forward, so the V8 developers start fixing it.
> Maybe
> we'll get some of these fixed too:
>
> http://lxr.free-electrons.com/source/include/linux/compiler.h#L115
> http://lxr.free-electrons.com/source/include/asm-generic/fixmap.h#L73


The first one, that #defines "if", is particularly disturbing.

Cheers,

Alberto

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAF3xnJRtyCRSqc5dh7fpf1pSQem_Lw4SbePQxY3dBC_xEEi=
sEg%40mail.gmail.com.

--001a114e5364ba3ed3054bc6d233
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2017=
-03-28 9:04 GMT+02:00 Thiago Macieira <span dir=3D"ltr">&lt;<a href=3D"mail=
to:thiago@macieira.org" target=3D"_blank">thiago@macieira.org</a>&gt;</span=
>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex">Em segunda-feira, 27 de mar=C3=A7o de =
2017, =C3=A0s 23:47:55 PDT, Alberto Barbati<br>
escreveu:<br>
<span class=3D"">&gt; &gt; And yet it&#39;s in use.<br>
&gt; &gt; <a href=3D"https://github.com/v8/v8/blob/master/src/x64/codegen-x=
64.cc#L33" rel=3D"noreferrer" target=3D"_blank">https://github.com/v8/v8/bl=
ob/<wbr>master/src/x64/codegen-x64.cc#<wbr>L33</a><br>
&gt;<br>
&gt; Thanks Thiago for the pointer. According to my (possibly incorrect)<br=
>
&gt; interpretation this code raises undefined behavior because __ is reser=
ved<br>
&gt; &quot;for any use&quot;, which I would expect includes the use as a ma=
cro name. I may<br>
&gt; be wrong, but I&#39;d expect little sympathy in the committee about po=
tentially<br>
&gt; breaking it. By the way, this code might possibly not break, because t=
hey<br>
&gt; were clever to put #undefs in it. Incidentally, the code would indeed =
break<br>
&gt; if we defined __ to be a macro...<br>
<br>
</span>Right. We can say it&#39;s V8&#39;s own fault for using a reserved i=
dentifier. It&#39;s<br>
like when Qt (qlalr) had an identifier called _Nullable, but that got<br>
repurposed by a recent Clang change.<br></blockquote><div><br></div><div>In=
 this particular instance, V8&#39;s programmer could and probably should ha=
ve used a non-reserved name (for example &quot;m_&quot; would have been a b=
etter choice regardless). Even the choice of _Nullable was ill-conceived, s=
ince identifiers beginning with an underscore and an uppercase letter are a=
lso reserved.<br>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m just saying it&#39;s known to be in use in a fairly major project. =
You know,<br>
the one that is behind Node.js and a whole ecosystem. The argument in the<b=
r>
paper that says it&#39;s little used is incorrect: it&#39;s not like pre-C+=
+11 &quot;auto&quot;,<br>
which had exactly one use in the entire Microsoft source code.<br></blockqu=
ote><div><br></div><div>I said that it&#39;s little used in the two librari=
esI have checked (VS2015 and libc++). For user code such as this, all I sai=
d is that &quot;the proposal should not break code&quot;, which is correct:=
 the identifier __ should not have been used in the first place, so this is=
 a case of code that someone might say &quot;deserves to be broken&quot;.<b=
r>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex">
I guess we could convince GCC and Clang to print a warning about it if it<b=
r>
looks like this is going forward, so the V8 developers start fixing it. May=
be<br>
we&#39;ll get some of these fixed too:<br>
<br>
<a href=3D"http://lxr.free-electrons.com/source/include/linux/compiler.h#L1=
15" rel=3D"noreferrer" target=3D"_blank">http://lxr.free-electrons.com/<wbr=
>source/include/linux/compiler.<wbr>h#L115</a><br>
<a href=3D"http://lxr.free-electrons.com/source/include/asm-generic/fixmap.=
h#L73" rel=3D"noreferrer" target=3D"_blank">http://lxr.free-electrons.com/<=
wbr>source/include/asm-generic/<wbr>fixmap.h#L73</a></blockquote><div><br><=
/div><div>The first one, that #defines &quot;if&quot;, is particularly dist=
urbing.<br><br></div><div>Cheers,<br><br></div><div>Alberto<br></div></div>=
</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/CAF3xnJRtyCRSqc5dh7fpf1pSQem_Lw4SbePQ=
xY3dBC_xEEisEg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAF3xnJRtyCRSqc5d=
h7fpf1pSQem_Lw4SbePQxY3dBC_xEEisEg%40mail.gmail.com</a>.<br />

--001a114e5364ba3ed3054bc6d233--

.
