Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-27 17:42:28

Andreas Huber <ah2003_at_[hidden]> writes:

>> Exits happen before entries, and you
>> can't undo an exit; that's status quo. If you get arrive at the point
>> where an entry is about to fail, then the preceding exit didn't fail,
>> so the possibility of a failing exit has no impact.
> As I have tried to explain before: The problem lies in the fact that you can
> have multiple exit actions called in a row before entry actions are called. If
> e.g. the second of those exit actions fails (the first one succeeded) then
> your state machine is in an invalid state from where it is impossible to
> recover.

Actually I don't understand why you say that. If exit actions are
called from innermost to outermost, it seems to me that you can simply
stop in the state whose exit action threw an exception without putting
the state machine into an *intrinsically* invalid state.

I am distinguishing *intrinsic* invalidity from a state that's
inconsistent with whole-program invariants. This is just the same
kind of guarantee std::vector gives: if an exception is thrown, the
invariants _of the vector_ are preserved, but there's no guarantee
that the state of the vector is consistent with the expectations of
the rest of the program.

Dave Abrahams
Boost Consulting

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