DMD 0.148 - scope guard
Dawid Ciężarkiewicz
dawid.ciezarkiewicz at gmail.com
Sun Feb 26 10:49:50 PST 2006
Dawid Ciężarkiewicz wrote:
> What do you think? Maybe later we'll come with better ideas.
VERSION F:
void LongFunction()
{
State save = UIElement.GetState();
register (scopepass) UIElement.SetState(save);
register (scopefail) UIElement.SetState(Failed(save));
...lots of code...
}
VERSION G:
void LongFunction()
{
State save = UIElement.GetState();
register (scope) {
case pass: UIElement.SetState(save); break;
case fail: UIElement.SetState(Failed(save));
}
...lots of code...
}
VERSION H:
void LongFunction()
{
State save = UIElement.GetState();
register {
case scopepass: UIElement.SetState(save); break;
case scopefail: UIElement.SetState(Failed(save));
}
...lots of code...
}
P.S.
If I get more ideas I will throw them all (with those already posted) in one
new thread.
More information about the Digitalmars-d
mailing list