Exception Safe Programming
renosky at free.fr
Sun Feb 25 03:31:33 PST 2007
Saaa a écrit :
> On the website there is the following example:
> Transaction abc()
> Foo f;
> Bar b;
> f = dofoo();
> b = dobar();
> return Transaction(f, b);
> catch (Object o)
> 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 (^.^)
That's probably because this is a counter-example, not an example
really: more a (convincing) way to show that scope() is much better than
try/catch for exception safe programming..
More information about the Digitalmars-d-learn