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!");
}

Reply via email to