Exception Safe Programming
Saaa
empty at needmail.com
Sat Feb 24 15:19:31 PST 2007
On the website there is the following example:
Transaction abc()
{
Foo f;
Bar b;
f = dofoo();
try
{
b = dobar();
return Transaction(f, b);
}
catch (Object o)
{
dofoo_undo(f);
throw o;
}
}
When f=dofoo() is run and doesn't succeed I suspect that f hasn't changed
and dofoo has thrown an exception.
Because of the exception the try part isn't run, but the catch part is.
Did I understand this correctly?
The explanation of the try statement on the website is not the most
comprehensible one (^.^)
More information about the Digitalmars-d-learn
mailing list