scope(exit) without exception handling?

Jonathan M Davis jmdavisProg at gmx.com
Tue May 15 23:28:06 PDT 2012


On Wednesday, May 16, 2012 07:30:44 Mehrdad wrote:
> 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...

It all depends on how it's implemented I guess. RAII doesn't directly have 
anything to do with exceptions (though it's a good way to write exception-safe 
code), so it would be perfectly possible to have it in a language with no 
exceptions at all, but I guess that it could be implemented in a manner 
similar to finally blocks, much as I wouldn't have expected it. I haven't 
looked at what exactly the compiler generates though, so if you've dug into 
that, you know more about it than I do.

- Jonathan M Davis


More information about the Digitalmars-d mailing list