220 40243 <94d79dd7-ba3b-4bf8-91ed-e5dc02b33670@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: florian.csdt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: more security concerns
Date: Fri, 28 Sep 2018 07:14:20 -0700 (PDT)
Lines: 236
Approved: news@gmane.org
Message-ID: <94d79dd7-ba3b-4bf8-91ed-e5dc02b33670@isocpp.org>
References: <CAFdMc-0NqfbqeOhhH1YiVGxDRVPv7COKNqge3mLu8UE8SgcXNw@mail.gmail.com>
 <CAO8_tC4kNZ6s-xMXo69n1D3dbOMkqt0fjLU44Uq5TfABp17hQQ@mail.gmail.com>
 <CAFdMc-1DpAUkYDVyNmP5H49XyNVDq5_T6UkEVaQGMGA0YEhNGw@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_358_140688532.1538144060833"
X-Trace: blaine.gmane.org 1538143937 327 195.159.176.226 (28 Sep 2018 14:12:17 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 28 Sep 2018 14:12:17 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC26HM4V3MIRBPPOXDOQKGQETRXATYQ@isocpp.org Fri Sep 28 16:12:12 2018
Return-path: <std-proposals+bncBC26HM4V3MIRBPPOXDOQKGQETRXATYQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb1-f198.google.com ([209.85.219.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC26HM4V3MIRBPPOXDOQKGQETRXATYQ@isocpp.org>)
	id 1g5tV6-0008RT-3j
	for gclcip-std-proposals@m.gmane.org; Fri, 28 Sep 2018 16:12:12 +0200
Original-Received: by mail-yb1-f198.google.com with SMTP id i11-v6sf3337147yba.8
        for <gclcip-std-proposals@m.gmane.org>; Fri, 28 Sep 2018 07:14:22 -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=Vbm/d1i6fgL6UPLr6a9wLZZLeJrD3TCkf4s9Y9vvBcE=;
        b=v4KUqUZdSJ1D3zQB7vFXyTf5/n6uZdznRZvB6lNsLdAU8v8Rmrp9mKkimnczYUVtgq
         sfCLeBwHsAaFtesDmbyw/e+3DZaz1Yok2JOITPnpOqOzkzHwNI+bP29tyODK7o0iyupL
         Gn0IWw+tu3yceqX2ViUO6elkK4E/Okfl8ESXYzFbw92EiKIu1uGtotB2Q9sOgUlfbScC
         gnF82/wHN+526cmsWBk89VJq6TcbdAa4RH/x+JtRImexCr+/rLbLlUDZPWnx8kyfhJZF
         N5n5FRpiJ1Hzyd/abAS75I/Rxqcq+Y+xmmEQZ8p+hdYt4Mf3i7cM0UljMaQUL73vTTHn
         IE7Q==
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=Vbm/d1i6fgL6UPLr6a9wLZZLeJrD3TCkf4s9Y9vvBcE=;
        b=tTBAEBb6RHF+IVF+mbWver2Lbcjut85+HolWz2g2m2xnzqnr5+Tclilj6HWRYBqK79
         1C0f+cW/Fgep7B4c5iu2jbDynWl9k7z6D4wQoxCwqcE+ddBeHrw1deBTbQfxQ2+MFW1W
         JQdKU3gbGfjCUA48WBmKRNJeISO50lSts9wqzv0l048yL38/NMvBtJgpfzYoxLTv35Po
         VJPYXsLkge6N1HfAmsh1nwTEDse5af7AEfGZKiOpd56FIaZS8NBFF2akS4dlYZi1iCQJ
         iwuAn+u+o+WcqengCjW+UiPKcxez2gTMLiCFI1YSPgXfYk7HPXWWJGeV9qhzW9KnUkWs
         ypFg==
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=Vbm/d1i6fgL6UPLr6a9wLZZLeJrD3TCkf4s9Y9vvBcE=;
        b=H/zQ+mD5oNPlqGlCQy+Wd5V8bMuQA02aXtXwfQyWqT996O720/jTa9J/GyZR1gSDfL
         jIYXxdScgKeP821itSK1/Zud+qhiNecaoVN7WHGr4ffaGNZTnxjVVuAP44g2wOI12c+N
         cy/uJeU6pZnhEtl7GRHgIwoo4k7BSjghKn6mSHgyVy1ZAv0L85c0HRXaDpfvbeU3XjTy
         NdWxQQ+/YBuE1n4Xhfi+DQVmw8jxDoMC5drhN4sSnnAFED/Nfsci4qyiV9pDTHeDSSiT
         6U6CcHd3ZVZxq/3XhvmkBDCWnGkFt2Bwj/TxQayChoEImmzjln+WWVa7zPURiSUMaAsv
         m3UQ==
X-Gm-Message-State: ABuFfoio6wYJrJ7P5scEAOd8gDUFiitB+dHm03TBHRS4FQQayNiFGiPY
	flVHLxXlLisT7CdNzEjkTWtMLg==
X-Google-Smtp-Source: ACcGV62lz2wK/YjkFYsTwR5QA9sJHJtSuOyiqCBLyz8pOaij994WoNY1Um9UpLSZKrLV80zvOU6thw==
X-Received: by 2002:a25:7651:: with SMTP id r78-v6mr5052643ybc.57.1538144062464;
        Fri, 28 Sep 2018 07:14:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:1d85:: with SMTP id d127-v6ls2585220ywd.11.gmail; Fri,
 28 Sep 2018 07:14:21 -0700 (PDT)
X-Received: by 2002:a81:78c6:: with SMTP id t189-v6mr165965ywc.7.1538144061269;
        Fri, 28 Sep 2018 07:14:21 -0700 (PDT)
In-Reply-To: <CAFdMc-1DpAUkYDVyNmP5H49XyNVDq5_T6UkEVaQGMGA0YEhNGw@mail.gmail.com>
X-Original-Sender: florian.csdt@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:40243
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40243>

------=_Part_358_140688532.1538144060833
Content-Type: multipart/alternative; 
	boundary="----=_Part_359_2102590875.1538144060833"

------=_Part_359_2102590875.1538144060833
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I want to highlight that [[nodiscard]] on functions is not about forcing=20
the compiler to keep the value, but instead to emit a warning if the user=
=20
doesn't use the value.
So meaning would be different.
In that respect, another attribute name might be better.

Also, it is already possible (but cumbersome) to implement already without=
=20
volatile:
void f() {
  int secret_int;
  float secret_float;
  /* ... */
  secret_int =3D 0;
  secret_float =3D 0
  asm volatile ("" ::"irm"(secret_int), "xm"(secret_float));
}

I would really like an attribute for that, though.


Le vendredi 28 septembre 2018 15:36:42 UTC+2, Daniel Gutson a =C3=A9crit :
>
> Yeah.  But please note that this is not only for function calls.
>
> void f()
> {
>    int secret;
>    ....
>    secret =3D 0;  //removed due to DSE
> }
>
> If I declare secret as volatile or write 0s to its address I may prevent=
=20
> the compiler to use a register impacting in performance. That's why I wan=
t=20
> to use the attribute here too.
>
>
>
> El vie., 28 sept. 2018 10:32, Andrew Giese <gies...@gmail.com=20
> <javascript:>> escribi=C3=B3:
>
>> I like the idea.
>> Function poisoning might also serve your needs. E.g.,=20
>> https://www.fluentcpp.com/2018/09/04/function-poisoning-in-cpp/
>>
>> If gcc poison were standardized in some fashion, you could write your ow=
n=20
>> wrappers to those functions with all the [[nodiscard]] you might want.
>>
>> Control in that case is a little less granular, indeed. Probably if=20
>> you're writing [[nodiscard]] on a per-expression basis you are not=20
>> discarding the result already.
>>
>> Regards
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAO8_tC4kNZ=
6s-xMXo69n1D3dbOMkqt0fjLU44Uq5TfABp17hQQ%40mail.gmail.com=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAO8_tC4kN=
Z6s-xMXo69n1D3dbOMkqt0fjLU44Uq5TfABp17hQQ%40mail.gmail.com?utm_medium=3Dema=
il&utm_source=3Dfooter>
>> .
>>
>

--=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/94d79dd7-ba3b-4bf8-91ed-e5dc02b33670%40isocpp.or=
g.

------=_Part_359_2102590875.1538144060833
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I want to highlight that [[nodiscard]] on functions is not=
 about forcing the compiler to keep the value, but instead to emit a warnin=
g if the user doesn&#39;t use the value.<br>So meaning would be different.<=
br>In that respect, another attribute name might be better.<br><br>Also, it=
 is already possible (but cumbersome) to implement already without volatile=
:<br><div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: brea=
k-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">voi=
d</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">f</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> secret_int</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">float</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> secret_float</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>/* ... */</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 secret_int </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 secret_floa=
t </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">asm</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">volatile</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&quot;&quot;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;ir=
m&quot;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">secret_int</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&quot;xm&quot;</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">secret_float</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">));</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><br>I would really li=
ke an attribute for that, though.<br><br><br>Le vendredi 28 septembre 2018 =
15:36:42 UTC+2, Daniel Gutson a =C3=A9crit=C2=A0:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"auto"><div>Yeah.=C2=A0 But please note that =
this is not only for function calls.<div dir=3D"auto"><br></div><div dir=3D=
"auto">void f()</div><div dir=3D"auto">{</div><div dir=3D"auto">=C2=A0 =C2=
=A0int secret;</div><div dir=3D"auto">=C2=A0 =C2=A0....</div><div dir=3D"au=
to">=C2=A0 =C2=A0secret =3D 0;=C2=A0 //removed due to DSE</div><div dir=3D"=
auto">}</div><div dir=3D"auto"><br></div><div dir=3D"auto">If I declare sec=
ret as volatile or write 0s to its address I may prevent the compiler to us=
e a register impacting in performance. That&#39;s why I want to use the att=
ribute here too.</div><div dir=3D"auto"><br></div><br><br><div class=3D"gma=
il_quote"><div dir=3D"ltr">El vie., 28 sept. 2018 10:32, Andrew Giese &lt;<=
a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"luZjexPSA=
AAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;retu=
rn true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">gies..=
..@gmail.com</a>&gt; escribi=C3=B3:<br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">=
<div dir=3D"auto"><div>I like the idea.<div dir=3D"auto">Function poisoning=
 might also serve your needs. E.g.,=C2=A0<a href=3D"https://www.fluentcpp.c=
om/2018/09/04/function-poisoning-in-cpp/" rel=3D"nofollow" target=3D"_blank=
" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%=
2F%2Fwww.fluentcpp.com%2F2018%2F09%2F04%2Ffunction-poisoning-in-cpp%2F\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF7-e2xXkIlyk3UcteakI63Ro7E0A&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%=
3A%2F%2Fwww.fluentcpp.com%2F2018%2F09%2F04%2Ffunction-poisoning-in-cpp%2F\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF7-e2xXkIlyk3UcteakI63Ro7E0A&#39;;re=
turn true;">https://www.fluentcpp.<wbr>com/2018/09/04/function-<wbr>poisoni=
ng-in-cpp/</a></div><div dir=3D"auto"><br></div><div dir=3D"auto">If gcc po=
ison were standardized in some fashion, you could write your own wrappers t=
o those functions with all the [[nodiscard]] you might want.</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">Control in that case is a little less=
 granular, indeed. Probably if you&#39;re writing [[nodiscard]] on a per-ex=
pression basis you are not discarding the result already.</div><div dir=3D"=
auto"><br></div><div dir=3D"auto">Regards</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"javascript:" rel=3D"nofollow" target=3D"_blank" gdf-obfu=
scated-mailto=3D"luZjexPSAAAJ" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" rel=3D"nofollo=
w" target=3D"_blank" gdf-obfuscated-mailto=3D"luZjexPSAAAJ" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/CAO8_tC4kNZ6s-xMXo69n1D3dbOMkqt0fjLU4=
4Uq5TfABp17hQQ%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;https:/=
/groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAO8_tC4kNZ6s-xMXo69n=
1D3dbOMkqt0fjLU44Uq5TfABp17hQQ%40mail.gmail.com?utm_medium\x3demail\x26utm_=
source\x3dfooter&#39;;return true;" onclick=3D"this.href=3D&#39;https://gro=
ups.google.com/a/isocpp.org/d/msgid/std-proposals/CAO8_tC4kNZ6s-xMXo69n1D3d=
bOMkqt0fjLU44Uq5TfABp17hQQ%40mail.gmail.com?utm_medium\x3demail\x26utm_sour=
ce\x3dfooter&#39;;return true;">https://groups.google.com/a/<wbr>isocpp.org=
/d/msgid/std-<wbr>proposals/CAO8_tC4kNZ6s-<wbr>xMXo69n1D3dbOMkqt0fjLU44Uq5T=
fA<wbr>Bp17hQQ%40mail.gmail.com</a>.<br>
</blockquote></div></div></div>
</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/94d79dd7-ba3b-4bf8-91ed-e5dc02b33670%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/94d79dd7-ba3b-4bf8-91ed-e5dc02b33670=
%40isocpp.org</a>.<br />

------=_Part_359_2102590875.1538144060833--

------=_Part_358_140688532.1538144060833--

.
