scope(failure) considered FREAKING AWESOME
Justin Johansson
no at spam.com
Sun Nov 8 14:34:21 PST 2009
Walter Bright Wrote:
> Justin Johansson wrote:
> > C++ constructors/destructors and stack-unwinding mechanism
> > are considered FREAKING AWESOME.
>
> Ok, good. Now write (using C++ RAII) the following where both
> transactions must succeed or neither:
>
> void foo()
> {
> A();
> scope (failure) undo_A();
> B();
> scope (failure) undo_B();
> writeln("A and B succeeded!");
> }
Thanks Walter; point taken.
Glad we had this discussion :-)
-- Justin
More information about the Digitalmars-d
mailing list