Boost logo

Boost :

Subject: Re: [boost] Noexcept
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2017-06-15 19:41:30


On Thu, Jun 15, 2017 at 11:45 AM, Ion Gaztañaga via Boost <
boost_at_[hidden]> wrote:

> On 14/06/2017 22:35, Edward Diener via Boost wrote:
> cutable.
>
>>
>>> It adds non-determinism because there is no upper bound when an
>>> exception is thrown.
>>>
>>
>> Please explain what this is supposed to mean, because it does not mean
>> anything to me.
>>
>
> It's not easy to know and no way to guarantee how much time the run-time
> plus your code needs to propagate the exception and execute the landing
> codee. With return codes you can measure it.
>

You can *measure* it with exceptions too. The unpredictability is because
you can't know *without* measuring how much time the C++ runtime needs to
unwind the stack in each case and on each platform.

However, this is true even if you don't use exceptions, because it depends
heavily on function inlining: if functions are inlined there is nothing to
unwind (with or without exceptions), and the difference in speed can be
orders of magnitude. This means that even if you don't use exceptions, the
only way to know how much time it'll take for an error code to bubble up
the call stack is to measure it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk