Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-03 16:16:55

"E. Gladyshev" <egladysh_at_[hidden]> writes:

>> This has *nothing* whatsoever to do with the basic guarantee, other
>> than that the basic guarantee is phrased in terms of invariants. Any
>> condition arising from this fact that you can conjure up with
>> exceptions can also be created without them. I suggest you drop
>> discussion of the basic guarantee and exceptions for the time being and
>> just look at invariants in stateful programming.
> 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.

> Do program invariants or basic guarantees change anything
> in how you handle exceptions?

I don't understand the question.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at