220 31586 <1607497.4jKLvpMD02@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: First draft of [[unreachable]] attribute proposal
Date: Mon, 13 Mar 2017 16:23:52 -0700
Lines: 44
Approved: news@gmane.org
Message-ID: <1607497.4jKLvpMD02@tjmaciei-mobl1>
References: <e6a951ab-a7eb-4bce-86fd-6988215e2309@isocpp.org> <996e889d-5922-4e13-84dd-d914ec44f5a4@isocpp.org> <51fa0491-97aa-48c8-b361-353f5ecc7a0f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1489447439 9997 195.159.176.226 (13 Mar 2017 23:23:59 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 13 Mar 2017 23:23:59 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBDGUTTDAKGQE2LDVUTA@isocpp.org Tue Mar 14 00:23:53 2017
Return-path: <std-proposals+bncBCB4TK757YBRBDGUTTDAKGQE2LDVUTA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f69.google.com ([74.125.83.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBDGUTTDAKGQE2LDVUTA@isocpp.org>)
	id 1cnZJh-0001x2-2H
	for gclcip-std-proposals@m.gmane.org; Tue, 14 Mar 2017 00:23:53 +0100
Original-Received: by mail-pg0-f69.google.com with SMTP id 77sf318156170pgc.5
        for <gclcip-std-proposals@m.gmane.org>; Mon, 13 Mar 2017 16:23:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding: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=gj90rIG54w5I30obiwJk93zQBlS2C1ir78/O+gU5P2c=;
        b=LrGL8ZKh+439Of54Tqq6OnZsE5DHdTFYucb8ofSDSUY09a9HDBwJY8xsn8JoUBMq/1
         ToJ88klFpdQe3FDlORazFxaaQl/OEzSYnfBheQqocby77eQ+tIITXXs2yadxItbU0Ccd
         LxEZaLmEcShdCrxE/vEvIOELVgT73rGLY61/UXlEdUAzwSHFVO8VwKGT88nNkKDopa6z
         6Lr/2GcIfBnL6PZyByyFQCwFms7d3w5nHXsIuZNIOL3HDzAs0Ud2+KbfPX6kAF0F7rvM
         /IJMjzr/p94Ch0m7uqzMtPSdHt6ohh3zU5YW+pPEH6Lz5gLrg1Y+LZrP+EWaniemmP6H
         6mxA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding: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=gj90rIG54w5I30obiwJk93zQBlS2C1ir78/O+gU5P2c=;
        b=Z0lyRWOjIJAXpHsAW93YUtc9lujxVNkwHUuPdrhHl5XV1NIlSHtZnESeN8u2ttClJL
         QDFqD58RhvDbLs2R8CHJJV8mQSKax8OeMQbvIE98iEdQN+ZcM2q15ZCsDXHoFYtWeWE6
         Tr/hhyJqGPcJ71YCG/tdySeM08BhMZOSBEobFQsE2sHO37bcBYzRp/568hIAiutqFtRR
         ZD8stUV/bJRLcPS3ZpL1KZqRwNOhwP8+xu1ewKYB3jv2NMXp9xJfwFk2clpllTeCVX+W
         wa+2MSAW0oZWTYhoUldYfFl82u0W8K1w7lzRnNsWJRxccSPxGvjW9SXi7T8uU+0myF+3
         kvJ 
X-Gm-Message-State: AMke39l2Ba1eEXKC4hr5LiVgY3CUey6QSr8f9rAH0AkyBmqvzXeI9yJ0ly38Bh1fMq7KoA==
X-Received: by 10.99.109.10 with SMTP id i10mr17380602pgc.152.1489447437312;
        Mon, 13 Mar 2017 16:23:57 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.4.119 with SMTP id 110ls14618306otc.44.gmail; Mon, 13 Mar
 2017 16:23:56 -0700 (PDT)
X-Received: by 10.55.214.209 with SMTP id p78mr33242521qkl.255.1489447436439;
        Mon, 13 Mar 2017 16:23:56 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id w3si1639266qtg.225.2017.03.13.16.23.56
        for <std-proposals@isocpp.org>;
        Mon, 13 Mar 2017 16:23:56 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (jfdmzpr02-ext.jf.intel.com [134.134.137.71])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 30D3E11B533
	for <std-proposals@isocpp.org>; Mon, 13 Mar 2017 16:23:54 -0700 (PDT)
In-Reply-To: <51fa0491-97aa-48c8-b361-353f5ecc7a0f@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
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:31586
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31586>

Em segunda-feira, 13 de mar=C3=A7o de 2017, =C3=A0s 13:28:28 PDT, Myriachan=
 escreveu:
>  I noticed that the draft of contractual programming does not say that
> behavior is undefined if the expression is false past an [[assert axiom]]=
..
> I asked co-author Professor J. Daniel Garcia about why the Standardese
> didn't say that the behavior is undefined, and his reply was:
>=20
> > Because that is not necessarily true. It is just that the assertion is =
not
> > checked.

I'm not sure I understand the answer. Let's say I have this in my code:

	[[assert: q.is_valid()]];

According to the answer, the assertion is something that the compiler need =
not=20
check anymore in the future, because I asserted that it is true. So what if=
 I=20
have later in the code path (possibly in an inlined function)

	if (q.is_valid())
		return q.pop();

How will the compiler react? If it deletes the check because I asserted its=
=20
result, it will call q.pop(), which may lead to a crash.

Isn't that the definition of UB?

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/1607497.4jKLvpMD02%40tjmaciei-mobl1.

.
