220 31558 <996e889d-5922-4e13-84dd-d914ec44f5a4@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: dan@soundradix.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: First draft of [[unreachable]] attribute proposal
Date: Sun, 12 Mar 2017 06:19:15 -0700 (PDT)
Lines: 180
Approved: news@gmane.org
Message-ID: <996e889d-5922-4e13-84dd-d914ec44f5a4@isocpp.org>
References: <e6a951ab-a7eb-4bce-86fd-6988215e2309@isocpp.org>
 <74928e4c-8f1e-4036-93d8-2560c27b651d@isocpp.org>
 <cc73faa8-2e33-4314-b50b-cf715b4e7ccf@isocpp.org>
 <f6b40768-7dbc-4019-b90b-f5c4398f0e25@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1670_1281867276.1489324755479"
X-Trace: blaine.gmane.org 1489324764 18914 195.159.176.226 (12 Mar 2017 13:19:24 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 12 Mar 2017 13:19:24 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCPJTS7U6MJBBVEVSXDAKGQE5YROXWY@isocpp.org Sun Mar 12 14:19:20 2017
Return-path: <std-proposals+bncBCPJTS7U6MJBBVEVSXDAKGQE5YROXWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPJTS7U6MJBBVEVSXDAKGQE5YROXWY@isocpp.org>)
	id 1cn3P2-0003ZI-Dc
	for gclcip-std-proposals@m.gmane.org; Sun, 12 Mar 2017 14:19:16 +0100
Original-Received: by mail-yw0-f198.google.com with SMTP id v76sf250667790ywg.4
        for <gclcip-std-proposals@m.gmane.org>; Sun, 12 Mar 2017 06:19:17 -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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=yMVjS/xpgvNRURPB7AFgwAGjL4gu++ChNVTsFyfnhPk=;
        b=dG3TBbTjyU+LVmhPEl4WeX3mpwZ8xCM6Bh3vzrJLP0vqTq1JuKPBsnpYMVoLVQkVlO
         ENQvn+NuLboh/j/8pAPHhO0KpUn003bOoUE4+k0GzzCEVj+Vb2d6gfH4e7umpovaVfWB
         f2Sy/VHFbNUsXEmxmAFKm8Oku/+QaxDfxkfOZnFgrYVS2XjyKWXzSiGRSVJ30mxtvGRW
         BoR77YcNmSHo2Tip0lw7lyiRNj0+8USs4CDDmCwxJPTGxlhdt1p+SYCTltpVkTTakriN
         AaidOHiC8ZVQ07/R3n8a8ox/ZzCZwH1EkIUno+sNqFRNODAqmvFcc+/Lie0eJBcTUnET
         5kgg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=soundradix.com; s=google;
        h=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=yMVjS/xpgvNRURPB7AFgwAGjL4gu++ChNVTsFyfnhPk=;
        b=NxV5Hsj43ZyIVPIDI6hz+S3nB2OuFmVN2jpSp5H1U7cu59wZ3VO7+DYfqHitsFBs3+
         Ipcx4ETMC5mMvrSmS7fRgs7EGO8ktbXeoaPzPnD+Vwdwk1ABuIGwuoNcpwKz9b+55OKJ
         69nKn3/GUQ3T4e/sTrfmmJ6XegMqf4nm8DnorMPwWTNtqRgM6p0dIVA02Uus2u6CvySa
         sVBW5ofKLUS7IhigJSDAPDYf76pZR4K7fTAm0FFIKSGdEevO+y40P1fE1GiNRzScs95G
         1zJomJlxz+ngYIFsAE8sbLhMOdOQWQ6SrnwLTByetoipN2rzMYd94nKmTYW8VOjnVxXq
         EoEg==
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=yMVjS/xpgvNRURPB7AFgwAGjL4gu++ChNVTsFyfnhPk=;
        b=AQcLkibbHpIUNtAcMfL/IaMEv8mf6/a+yjallUFLvgICV3U5WPfW804JcA6n/TgfJ+
         XXnMafG3kVWEwZ0kj/mPjUJsm3GxJaik8/v1oCbiAOOkxznFx4l3CoRpX8eG2QCuKclP
         Sicl3fVCLI9SF3cmzkZvtb0QySuPAfe59dvCGFTi3UHWWKbGLB+vaNTtPKR1kGs+j8ZX
         kfSILYUcxE9R157gHy9vBbVh5MiggARLaxe2f57JarJOgdx15YBkDkgrjiORJDPrZyoG
         BKsTTQYaShyrCzYT/vtSuF/LvVbvV1dXR0sScrEUyQNSY/3jM8Htrr+Y3lZcIsyJlSAC
         VEkQ==
X-Gm-Message-State: AMke39n7Ka4Bznv549HaRFpjIauj1miVruj4SaGha7/r3QY1kFbYcUvxGRxxDK8L/yWkhA==
X-Received: by 10.129.107.134 with SMTP id g128mr14464687ywc.139.1489324757000;
        Sun, 12 Mar 2017 06:19:17 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.53.6 with SMTP id o6ls13649825otc.47.gmail; Sun, 12 Mar
 2017 06:19:16 -0700 (PDT)
X-Received: by 10.157.13.82 with SMTP id 76mr2947770oti.6.1489324756162;
        Sun, 12 Mar 2017 06:19:16 -0700 (PDT)
In-Reply-To: <f6b40768-7dbc-4019-b90b-f5c4398f0e25@isocpp.org>
X-Original-Sender: dan@soundradix.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:31558
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31558>

------=_Part_1670_1281867276.1489324755479
Content-Type: multipart/alternative; 
	boundary="----=_Part_1671_340757506.1489324755479"

------=_Part_1671_340757506.1489324755479
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I think the opposite is correct WRT tooling; if you have a separate=20
[[unreachable]] attribute, not only does it convey the intention better to=
=20
the reader, but it also does to any tool which sees the attribute, so for=
=20
example a static analyzer can show exactly the path in which=20
[[unreachable]] code becomes reachable, but not necessarily show it for=20
failing [[assert]] attributes.

Cheers,
Dan


On Saturday, March 11, 2017 at 4:24:35 PM UTC+2, Andrzej Krzemie=C5=84ski w=
rote:
>
>
>
> W dniu pi=C4=85tek, 10 marca 2017 13:41:05 UTC+1 u=C5=BCytkownik Morwenn =
napisa=C5=82:
>>
>> Le vendredi 10 mars 2017 13:04:37 UTC+1, Andrzej Krzemie=C5=84ski a =C3=
=A9crit :
>>>
>>>
>>>
>>> W dniu czwartek, 9 marca 2017 04:49:35 UTC+1 u=C5=BCytkownik Myriachan=
=20
>>> napisa=C5=82:
>>>>
>>>> I wrote up a proposal document for a new attribute, [[unreachable]],=
=20
>>>> which lets you mark locations in code as being unreachable for optimiz=
ation=20
>>>> purposes, or to suppress certain warnings.
>>>>
>>>> This has been discussed on the mailing list before; there's a link to=
=20
>>>> that thread in the .pdf.
>>>>
>>>> https://1drv.ms/b/s!Agwy_QljRwlGgcoJeZMiimuq3H36Ww=20
>>>> <https://www.google.com/url?q=3Dhttps%3A%2F%2F1drv.ms%2Fb%2Fs!Agwy_Qlj=
RwlGgcoJeZMiimuq3H36Ww&sa=3DD&sntz=3D1&usg=3DAFQjCNH4Mt71oANAe87AA1PY9Qf74w=
5yWQ>
>>>>
>>>> I have no idea what to do with it now.  If you have any comments on th=
e=20
>>>> content, or how to actually proceed, let me know! =3D^-^=3D
>>>>
>>>>
>>>> Under the contract proposal, anywhere where the statement is expected,=
=20
>>>> you can type:
>>>>
>>>> [[assert: false]];
>>>>
>>>> While [[assert axiom: false]] is probably semantically equivalent to=
=20
>>>> the proposed [[unreachable]], the former doesn't really convey the=20
>>>> meaning.
>>>>
>>>> I would be more confortable adding [[unreachable]] to the default=20
>>>> branch of a switch than the equivalent [[assert axiom: false]].
>>>>
>>>
> Given that the expression in the assertion is a compile-time constant onl=
y=20
> [[assert: false]] is fine. But the interaction goes beyond only syntax. I=
f=20
> we have attribute [[unreachable]] maybe we want it to behave like [[asser=
t:=20
> false]] in every detail; that is: allow calling contract violation handle=
rs=20
> in test builds, if this place in the code is reached. This way the hint c=
an=20
> be used not only for optimization, but also for instrumentation.
>
> Regards,
> &rzej;
>

--=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/996e889d-5922-4e13-84dd-d914ec44f5a4%40isocpp.or=
g.

------=_Part_1671_340757506.1489324755479
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I think the opposite is correct WRT tooling; if you have a=
 separate [[unreachable]] attribute, not only does it convey the intention =
better to the reader, but it also does to any tool which sees the attribute=
, so for example a static analyzer can show exactly the path in which [[unr=
eachable]] code becomes reachable, but not necessarily show it for failing =
[[assert]] attributes.<br><br>Cheers,<div>Dan<br><div><br><br>On Saturday, =
March 11, 2017 at 4:24:35 PM UTC+2, Andrzej Krzemie=C5=84ski wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><br>W dniu pi=C4=
=85tek, 10 marca 2017 13:41:05 UTC+1 u=C5=BCytkownik Morwenn napisa=C5=82:<=
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">Le vendredi 10 mars=
 2017 13:04:37 UTC+1, Andrzej Krzemie=C5=84ski a =C3=A9crit=C2=A0:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><br>W dniu czwartek, 9 =
marca 2017 04:49:35 UTC+1 u=C5=BCytkownik Myriachan napisa=C5=82:<blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div>I wrote up a proposal document for a new=
 attribute, [[unreachable]], which lets you mark locations in code as being=
 unreachable for optimization purposes, or to suppress certain warnings.<br=
><br>This has been discussed on the mailing list before; there&#39;s a link=
 to that thread in the .pdf.<br><br><a href=3D"https://www.google.com/url?q=
=3Dhttps%3A%2F%2F1drv.ms%2Fb%2Fs!Agwy_QljRwlGgcoJeZMiimuq3H36Ww&amp;sa=3DD&=
amp;sntz=3D1&amp;usg=3DAFQjCNH4Mt71oANAe87AA1PY9Qf74w5yWQ" rel=3D"nofollow"=
 target=3D"_blank" onmousedown=3D"this.href=3D&#39;https://www.google.com/u=
rl?q\x3dhttps%3A%2F%2F1drv.ms%2Fb%2Fs!Agwy_QljRwlGgcoJeZMiimuq3H36Ww\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH4Mt71oANAe87AA1PY9Qf74w5yWQ&#39;;return =
true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A=
%2F%2F1drv.ms%2Fb%2Fs!Agwy_QljRwlGgcoJeZMiimuq3H36Ww\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNH4Mt71oANAe87AA1PY9Qf74w5yWQ&#39;;return true;">https://1=
drv.ms/b/s!Agwy_<wbr>QljRwlGgcoJeZMiimuq3H36Ww</a><br><br>I have no idea wh=
at to do with it now.=C2=A0 If you have any comments on the content, or how=
 to actually proceed, let me know! =3D^-^=3D<br><br><br>Under the contract =
proposal, anywhere where the statement is expected, you can type:<br><br><d=
iv style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187)=
;border-style:solid;border-width:1px"><code><div><span style=3D"color:#660"=
>[[</span><span style=3D"color:#008">assert</span><span style=3D"color:#660=
">:</span><span style=3D"color:#000"> </span><span style=3D"color:#008">fal=
se</span><span style=3D"color:#660">]];</span></div></code></div><br>While =
<span style=3D"font-family:courier new,monospace">[[assert axiom: false]]</=
span> is probably semantically equivalent to the proposed <span style=3D"fo=
nt-family:courier new,monospace">[[unreachable]]</span>, the former doesn&#=
39;t really convey the meaning.<br><br>I would be more confortable adding <=
span style=3D"font-family:courier new,monospace">[[unreachable]]</span> to =
the <span style=3D"font-family:courier new,monospace">default</span> branch=
 of a <span style=3D"font-family:courier new,monospace">switch</span> than =
the equivalent <span style=3D"font-family:courier new,monospace">[[assert a=
xiom: false]]<font face=3D"arial,sans-serif">.</font></span></div></blockqu=
ote></div></blockquote></div></blockquote><div><br>Given that the expressio=
n in the assertion is a compile-time constant only [[assert: false]] is fin=
e. But the interaction goes beyond only syntax. If we have attribute [[unre=
achable]] maybe we want it to behave like [[assert: false]] in every detail=
; that is: allow calling contract violation handlers in test builds, if thi=
s place in the code is reached. This way the hint can be used not only for =
optimization, but also for instrumentation.<br><br>Regards,<br>&amp;rzej;<b=
r></div></div></blockquote></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/996e889d-5922-4e13-84dd-d914ec44f5a4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/996e889d-5922-4e13-84dd-d914ec44f5a4=
%40isocpp.org</a>.<br />

------=_Part_1671_340757506.1489324755479--

------=_Part_1670_1281867276.1489324755479--

.
