Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-03 16:56:23


E. Gladyshev wrote:
> --- David Abrahams <dave_at_[hidden]> wrote:
>> "E. Gladyshev" <egladysh_at_[hidden]> writes:
>>> The point of my question was how to use basic guarantees
>>> in practice especially in case of an exception.
>>> Usually I am making two assumptions.
>>> If there is an an exception then:
>>> 1. There is a problem with the hardware.
>>> 2. The program is incorrect and the invariants,
>>> integrity of the memory and program stack can be broken.
>>> In both cases, I don't think that it is safe to do anything.
>>
>> Right. But both those assumptions are in general wrong. Exceptions
>> are thrown when postconditions can't be satisfied ("I can't allocate
>> enough memory to resize this vector"), not when something's
>> fundamentally broken in the program or hardware.
>
> Ok, but how do you differentiate "fundamentally-broken"
> exceptions from "good" exceptions in your code?

If you use exceptions to indicate that something is fundamentally broken,
that's your own problem. Formal correctness theory doesn't acknowledge or
care about such situations. Once something is fundamentally broken, there
are no guarantees. None. You are in another dimension where formal theory
simply doesn't apply.


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