DMD 0.148 - scope guard
Walter Bright
newshound at digitalmars.com
Sun Feb 26 10:09:57 PST 2006
"Hasan Aljudy" <hasan.aljudy at gmail.com> wrote in message
news:dtsfm5$1h2i$1 at digitaldaemon.com...
> Why not just reuse "finally"?
>
> void func()
> {
> init_some_reource();
> foo(); // foo throws an exception
> //func doesn't catch the exception
> //but it has a finally clause
>
> finally //aka on scope exit, whether success or fail
> {
> release_the_resource();
> }
> }
finally does work for on_scope_exit, but it leaves on_scope_success and
on_scope_failure hanging.
More information about the Digitalmars-d
mailing list