Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-11-03 18:01:25


--- Peter Dimov <pdimov_at_[hidden]> wrote:
[...]
>
> Exception safety guarantees state what happens if an exception is thrown in
> a correct program,

I understand that but how do you make sure that
your program is correct?
In any practically interesting application,
I don't think that it is possible.
If you cannot prove that your program is correct
(most likely you cannot), you don't have exception
safety guarantees, do you?
If you add possible h/w, third party library, OS
issues then in *practice* you don't have safety
guarantees even for correct programs.
If the above is true, then why do we have
to pay for exception safety guarantees?

I guess we can limit the exception safety guarantees
for a case of known exception types.
Somehing like this:

my_type *p = new my_type;
try()
{
   p->f()
}
catch( out_of_memory ) //expected exception
{
   delete p; //safe to delete
}
catch( ... )
{
   //nothing is safe here
}

If this is the case, then we need to make sure
that our libraries don't just throw exceptions.
So statements like 'throw;' should not be allowed.
This could be hard to accomplish.

Eugene

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/


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