scope(exit) without exception handling?

Mehrdad wfunction at hotmail.com
Tue May 15 22:30:44 PDT 2012


On Wednesday, 16 May 2012 at 05:06:51 UTC, Jonathan M Davis wrote:

> scope(exit) stuff;
> otherStuff;
>
> is lowered to something like
>
> try
> {
>     otherStuff;
> }
> finally
> {
>     stuff;
> }
>
> So, you can use scope(exit) if the above code is acceptable for 
> whatever you're doing. Otherwise, no, you can't.

Thanks, though I already knew that...


> Destructors should work regardless of what you're doing with 
> exceptions though, so I would expect RAII to work.


Well, RAII is pretty much just a finally block...
It seems like all of these emit references _d_local_unwind2 and 
stuff, so it seems like it's not the way you expect...


More information about the Digitalmars-d mailing list