220 33087 <12a8cbd7-49cc-4a4f-810d-39670fa1472a@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Support for exception-less error handling
Date: Mon, 3 Jul 2017 13:50:07 -0700 (PDT)
Lines: 148
Approved: news@gmane.org
Message-ID: <12a8cbd7-49cc-4a4f-810d-39670fa1472a@isocpp.org>
References: <b5a114a6-dbc3-45ff-b45b-b46cdcc51a03@isocpp.org> <6856d8da-734e-44c9-b45b-890f3142f83b@isocpp.org>
 <CADbh+eStrnKpi-vxcHk1k4zzbkGaJsYOMDbkfZNMVvCtswAogQ@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_2096_232308588.1499115007248"
X-Trace: blaine.gmane.org 1499115015 7563 195.159.176.226 (3 Jul 2017 20:50:15 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 3 Jul 2017 20:50:15 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB7635LFAKGQE7VJDGAQ@isocpp.org Mon Jul 03 22:50:11 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBB7635LFAKGQE7VJDGAQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f198.google.com ([209.85.223.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB7635LFAKGQE7VJDGAQ@isocpp.org>)
	id 1dS8IF-0001N1-ML
	for gclcip-std-proposals@m.gmane.org; Mon, 03 Jul 2017 22:50:03 +0200
Original-Received: by mail-io0-f198.google.com with SMTP id k2sf100992113ioe.4
        for <gclcip-std-proposals@m.gmane.org>; Mon, 03 Jul 2017 13:50:09 -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=MIePyBBfUDt7N6qiaf5DYxTRHBnqTE//rUlVPjV5XPk=;
        b=Ua4HKwkcXf8UfjRMbi9Oom+kB9I2rFWcAg82SHzWfPEXjfbMJ+qhIOqtSePS7r7LfQ
         BGBhVPejPu1dTwhmx5DkPZWOzv+j66qYC/jcGkOTyIA9J1gUCFl7Rtdbpw2Odryf4TX2
         N8FSQnJCNBZPhSLs9TXpowbtXNHzHO+t1C6YaVvzCqt3XyTGdR1mdg/RH+qAr1tJaAeH
         zv60fv7vU2Gjfb1BPpCovVGETcR88u0fw37VBHpfB8NPZvQd0wBcRYqHN0u4LzrBeOEk
         FjUo+fKkY5RGHvN7Wsl5xZLo0rsQTeYjJ1J0vCwxZ24DO9ZcXT++5Pb+fZDcneratbyy
         lWWQ==
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=MIePyBBfUDt7N6qiaf5DYxTRHBnqTE//rUlVPjV5XPk=;
        b=UO4ZMiowiQeLwUHHgJ+sJZ0L7SBm0Lcd9bZtT7u4aokp3NnD+x3kOJGPTv4S10BHzt
         kniMUztfml6mKlpICC86dOKzoywPMjhq4r8uQ3U4m+EiCIH7S4/SB500j2ilXq1o5pmj
         3dqMYZxED6I/V9qooynmD0gxK9XY8Xy3QXChFJ9hu4vNHiSem6qyXvzQKOGtKTOxw6d1
         uQCWwAx8J1Mrt80Rj46GJh+jDnFuKSf6OdXaimMxKE88sEkFESv/rpClb7r4gS2eSDET
         LcewJCauCSW0q3kG/v7CeqewEWcbdbvQoFDj2kNFK8FUBGa4Ls5XE+Z5ppGHjEVQWgxS
         fvSg==
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=MIePyBBfUDt7N6qiaf5DYxTRHBnqTE//rUlVPjV5XPk=;
        b=qSgxE3e4/Tu8UlcRzrdObrlb1HNmG9UimzdSdNJfj0QoftDZGPu89ti2MMOlNNb9Or
         UdYUKavv2GzTPgJfeEYBYyhXnkVJRDh8+JgHC1zpb7Xs0L3FBCD1U9NdAUEzE8TMeo2J
         2gIzP08+D3F/qhz1dDGrg70i/DxKLlKFPLbP8zqMqFIxiEcYBM+DBumMc7EQ4sWKv434
         v+dkgeoqrmCApfNALZjgs5BWHSVKSrqbWbFXVbaP5zUutVaK46YpvNic1qS7IUHTQ2OP
         8VL28AsbA3d3XEjt2tQHXaMskhmh2dktGwnOOI6FY2dxZmF6h+oSoe+tuRT3/xGDoym+
         18hA==
X-Gm-Message-State: AKS2vOyfJ9AmiPnr1myWJfXqTRu6p/2jERtW+uDgvfO0RHaGBQCjFWGE
	DXllG2yvfW98F5zx
X-Received: by 10.36.160.194 with SMTP id o185mr19192243ite.7.1499115008959;
        Mon, 03 Jul 2017 13:50:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.93.4 with SMTP id w4ls7035182ita.22.gmail; Mon, 03 Jul 2017
 13:50:07 -0700 (PDT)
X-Received: by 10.36.65.25 with SMTP id x25mr150898ita.9.1499115007662;
        Mon, 03 Jul 2017 13:50:07 -0700 (PDT)
In-Reply-To: <CADbh+eStrnKpi-vxcHk1k4zzbkGaJsYOMDbkfZNMVvCtswAogQ@mail.gmail.com>
X-Original-Sender: jmckesson@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:33087
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33087>

------=_Part_2096_232308588.1499115007248
Content-Type: multipart/alternative; 
	boundary="----=_Part_2097_1814101434.1499115007249"

------=_Part_2097_1814101434.1499115007249
Content-Type: text/plain; charset="UTF-8"

On Monday, July 3, 2017 at 4:44:38 PM UTC-4, Brittany Friedman wrote:
>
> On Mon, Jul 3, 2017 at 3:21 PM, Bengt Gustafsson <bengt.gu...@beamways.com 
> <javascript:>> wrote:
>
>> I would doubt that the runtime overhead of exceptions is worse than that 
>> of checking return values and continue returning out the call stack. 
>> Especially in the no-error case it should be more efficient as those ifs 
>> have potentially large runtime penalty regardless of if the jump 
>> instruction is taken or not, while the exception unwinding code is 
>> typically very asymmetric with a minimized runtime cost for the non-throw 
>> case.
>>
>> So before suggesting another mechanism that simplifies writing code based 
>> on error returns I would suggest actually measuring the performance in the 
>> throwing and non-throwing case compared to a return value/if-based 
>> solution. This article is not totally clear but casts serious doubts about 
>> any speed gain from avoiding exceptions:
>>
>>
>> https://stackoverflow.com/questions/13835817/are-exceptions-in-c-really-slow
>>
>> Unfortunately (or fortunately as it is so old) the TS report linked to 
>> does not show numbers for exception handling. Maybe someone else can point 
>> to a paper detailing the performance for the different approaches?
>>
>>
> There are plenty of reasons to use error codes or error-code-like-entities 
> that are not motivated solely by performance considerations.
>
> Some users find error codes easier to audit and work with (no hidden 
> control flow).
> Some users are on platforms that recommend against or forbid the use of 
> exception handling. The platform vendor in question does not provide a 
> high-quality exception handling mechanism.
> Some users don't want to pay for the *memory* overhead of the so-called 
> """""""""zero cost""""""""" (there are not enough scare-quotes in the 
> world) mechanism.
>
Exceptions do not compose well (see the now defunct exception_list)
>

Neither do error codes. Generally speaking, two sets of error codes from 
two different libraries cannot be composed without creating a list of error 
codes.

If we presume that exceptions can in *some* cases be slower, then if 
> "errors" are very common or if you require *predictable* performance 
> characteristics, exceptions may be unacceptable.
>

That's a "performance consideration".

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/12a8cbd7-49cc-4a4f-810d-39670fa1472a%40isocpp.org.

------=_Part_2097_1814101434.1499115007249
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, July 3, 2017 at 4:44:38 PM UTC-4, Brittany Frie=
dman wrote:<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"><d=
iv><div class=3D"gmail_quote">On Mon, Jul 3, 2017 at 3:21 PM, Bengt Gustafs=
son <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obf=
uscated-mailto=3D"sFUZvYfWAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascri=
pt:&#39;;return true;">bengt.gu...@beamways.com</a><wbr>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I wou=
ld doubt that the runtime overhead of exceptions is worse than that of chec=
king return values and continue returning out the call stack. Especially in=
 the no-error case it should be more efficient as those ifs have potentiall=
y large runtime penalty regardless of if the jump instruction is taken or n=
ot, while the exception unwinding code is typically very asymmetric with a =
minimized runtime cost for the non-throw case.<div><br></div><div>So before=
 suggesting another mechanism that simplifies writing code based on error r=
eturns I would suggest actually measuring the performance in the throwing a=
nd non-throwing case compared to a return value/if-based solution. This art=
icle is not totally clear but casts serious doubts about any speed gain fro=
m avoiding exceptions:</div><div><br></div><div><a href=3D"https://stackove=
rflow.com/questions/13835817/are-exceptions-in-c-really-slow" target=3D"_bl=
ank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.co=
m/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F13835817%2Fare-exc=
eptions-in-c-really-slow\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGxQJSKjIsm=
IsPOL0HqtDJdPmQ-DQ&#39;;return true;" onclick=3D"this.href=3D&#39;https://w=
ww.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F138358=
17%2Fare-exceptions-in-c-really-slow\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNGxQJSKjIsmIsPOL0HqtDJdPmQ-DQ&#39;;return true;">https://stackoverflow.com=
/<wbr>questions/13835817/are-<wbr>exceptions-in-c-really-slow</a></div><div=
><br></div><div>Unfortunately (or fortunately as it is so old) the TS repor=
t linked to does not show numbers for exception handling. Maybe someone els=
e can point to a paper detailing the performance for the different approach=
es?<div><div><div><br></div></div></div></div></div></blockquote><div><br><=
/div><div>There are plenty of reasons to use error codes or error-code-like=
-entities that are not motivated solely by performance considerations.</div=
><div><br></div><div>Some users find error codes easier to audit and work w=
ith (no hidden control flow).</div><div>Some users are on platforms that re=
commend against or forbid the use of exception handling. The platform vendo=
r in question does not provide a high-quality exception handling mechanism.=
</div><div>Some users don&#39;t want to pay for the *memory* overhead of th=
e so-called &quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;zero cost=
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;=C2=A0(there are not =
enough scare-quotes in the world) mechanism.</div></div></div></div></block=
quote><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><d=
iv class=3D"gmail_quote"><div>Exceptions do not compose well (see the now d=
efunct exception_list)</div></div></div></div></blockquote><div><br>Neither=
 do error codes. Generally speaking, two sets of error codes from two diffe=
rent libraries cannot be composed without creating a list of error codes.<b=
r><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><=
div><div class=3D"gmail_quote"><div>If we presume that exceptions can in *s=
ome* cases be slower, then if &quot;errors&quot; are very common or if you =
require *predictable* performance characteristics, exceptions may be unacce=
ptable.</div></div></div></div></blockquote><div><br>That&#39;s a &quot;per=
formance consideration&quot;.<br></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/12a8cbd7-49cc-4a4f-810d-39670fa1472a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/12a8cbd7-49cc-4a4f-810d-39670fa1472a=
%40isocpp.org</a>.<br />

------=_Part_2097_1814101434.1499115007249--

------=_Part_2096_232308588.1499115007248--

.
