220 24169 <3004028.jdIGuf4xbV@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Proposal: Change the specified behavior when
 control flow reaches the end of non-void functions
Date: Wed, 03 Feb 2016 10:21:41 -0800
Lines: 38
Approved: news@gmane.org
Message-ID: <3004028.jdIGuf4xbV@tjmaciei-mobl4>
References: <5115b78c-8fb4-4c72-a278-f74c636f5217@isocpp.org> <n8tfc1$4v6$1@ger.gmane.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1454523724 26040 80.91.229.3 (3 Feb 2016 18:22:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 3 Feb 2016 18:22:04 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBPMKZG2QKGQE3KFMX7I@isocpp.org Wed Feb 03 19:21:51 2016
Return-path: <std-proposals+bncBCB4TK757YBRBPMKZG2QKGQE3KFMX7I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f71.google.com ([74.125.82.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBPMKZG2QKGQE3KFMX7I@isocpp.org>)
	id 1aR23r-0007vl-Ag
	for gclcip-std-proposals@m.gmane.org; Wed, 03 Feb 2016 19:21:51 +0100
Original-Received: by mail-wm0-f71.google.com with SMTP id p63sf31334034wmp.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 03 Feb 2016 10:21:50 -0800 (PST)
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:user-agent:in-reply-to:references
         :mime-version:content-type: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=Z0xSMZKn2PGZxCmhIhtt3+LUZryAg7ZXAlo+7/CkOEg=;
        b=vro4oN5fygiYQQJb5Np2dOt+9jLeIKt+F1u82VWt2b7pzDWItF3NO5DpFRb72GOzzQ
         Vr07VCgXV4ar2RAKcgK2cjyJIScGp/k2l2TtT8wiHBgNsIx6KdK4etTKcFuwxT1h+SjW
         LLWkq4mhHi9CxGxppVGNFEotTCE2qfUwfuDIPfkuYIAszYhEE6x6JkcHyZgOf510yKq8
         0pMFTrvySQpEh2FXqQEdR4V4iRJKFtcCqBDOsHZwx5SpEPdhRqOeDI4zplj1tXn/2NuM
         2OZdVEYMvt+uhkNlHWNIyUiEh4JlM9ZXpDKHHl3fE8yJXemXR2xJEjInEMlsxOLi6uqN
         koWA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type: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=Z0xSMZKn2PGZxCmhIhtt3+LUZryAg7ZXAlo+7/CkOEg=;
        b=JJ36l2qWTQdgtlF0T7ZXhO6JxH3W/XO3OSIUDxlBEbAO4h2ha17q1V9E8L8USVfi6u
         k7+79iIYxH/GnxRVfhkgn7PBuJMge3Bc+LZpju/v0I35EJR9+X1g5PL9tOkxRqS0gpOg
         d0K/HbbIk1/T4nhgbkMl+HCieig7XFc0/gbrCm8GhyYMtX/8hrvx2xPMdMpRBv/eLCtT
         Wt+AR8uaaCTbj816EsFwXAsZa9d5Np8+gAM5aaC8EUjSYZ7tcMZNiPJJlKiGCLPqxXL7
         D2GLu14LZCZe31BwE5vnWc4dMjdiZq4FabUPno/+7DTf6aHttp9ekgzUn3R4kBtaRld5
         CfQg= 
X-Gm-Message-State: AG10YOTzVbEr1qCtW2hsGQK3kvGMFoOyM6bVnQXVcYKLo0l3giAUZHANpbgCnM2r6tJLKQ==
X-Received: by 10.25.154.129 with SMTP id c123mr531320lfe.1.1454523710376;
        Wed, 03 Feb 2016 10:21:50 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.5.208 with SMTP id 199ls437729wmf.46.gmail; Wed, 03 Feb
 2016 10:21:49 -0800 (PST)
X-Received: by 10.194.77.137 with SMTP id s9mr3276766wjw.171.1454523709246;
        Wed, 03 Feb 2016 10:21:49 -0800 (PST)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id df6si11589243wjc.222.2016.02.03.10.21.49
        for <std-proposals@isocpp.org>;
        Wed, 03 Feb 2016 10:21:49 -0800 (PST)
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-mobl4.localnet (jfdmzpr03-ext.jf.intel.com [134.134.139.72])
	by gondolin.macieira.info (Postfix) with ESMTPSA id CBF1F11A457
	for <std-proposals@isocpp.org>; Wed,  3 Feb 2016 10:21:47 -0800 (PST)
User-Agent: KMail/5.1.1 (Linux/4.3.3-6-default; KDE/5.18.0; x86_64; ; )
In-Reply-To: <n8tfc1$4v6$1@ger.gmane.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-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:24169
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/24169>

On quarta-feira, 3 de fevereiro de 2016 13:02:41 PST Matthew Woehlke wrote:
> > The reason for this is to make it easier to catch this undefined behavior
> > by requiring the program to fail fast.
> 
> I previously proposed to make falling off a function be ill-formed:
> https://groups.google.com/a/isocpp.org/d/msg/std-proposals/zu7IxDnnrNA/Yqjif
> ANZtVsJ. I strongly encourage you to read that thread, as much of the same
> ground has been covered already.

There's a big difference with the two proposals. To make it ill-formed, you 
require the compiler to have absolutely no false positives or negatives. To 
make it call std::terminate(), we're only defining previously undefined 
behaviour and we don't need a 100% success rate.

Code expansion won't be big either and it may be even reduce code size.

> > Most programmers deal with the situation by diligently paying attention to
> > compiler warnings
> 
> ...or you could just compile with -Werror=return-type. No diligence
> required; your code won't build and you'll *have* to fix it.

As Chris said in his OP, this does not catch everything due to false positives 
and false negatives. The compiler is allowed to give up if it can't prove one 
way or the other, so it often opts for assuming you know what you've done.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

-- 

--- 
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.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

.
