From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-09 11:22:59
--- David Abrahams <dave_at_[hidden]> wrote:
> Yes, any code which creates classes in automatic variables benefits,
> because you know it isn't going to crash when it unwinds. But that's
> just one example. If you have, for example, a dynamically-allocated
> class instance which isn't destroyed during unwinding, you can be sure
> that it's still in a valid state after an exception has been thrown.
> If you don't know that program invariants are preserved, you can
> basically do nothing reliably. This is error-handling 101; if you
> want to challenge established wisdom in this area, well, I guess I
> won't argue with you (because it seems futile) but I think it'll take
> more than your disbelief to convince me that it's useful.
I don't care about anybody's wisdom or convincing anyone for
the same matter. It is a technical discussion.
I just want to know how to use basic guarantees in practice.
> > Remember that after the exception the original object could be
> > already gone. The variant has just a value initilized object now.
> > Who cares whether this value initialized object has a type from
> > variant types or of some internal type. The rest of the code will
> > have to be able to handle it anyway.
> No, that's incorrect. The rest of the code would not have to handle the
> internal type if the variant always contains one of the types it was
> specified with.
What is the big difference with the singular variant if it has a value
that was changed by the variant internals.
It is even worse. In the case of singular variant you need just one
additional case in the rest of your program.
In the case of basic guarantees you need to be able to
handle unexpected value modifications for all the types.
Again how do you handle it in practice?
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk