scope(exit) without exception handling?
deadalnix
deadalnix at gmail.com
Wed May 16 14:15:06 PDT 2012
Le 16/05/2012 08:59, Walter Bright a écrit :
> On 5/15/2012 8:54 PM, Mehrdad wrote:
>> Is there any way for me to use scope(exit) (or perhaps a destructor,
>> like RAII)
>> to mean, "Execute this block of code for me when the block is exited,
>> will ya?",
>> *without* introducing dependencies on exception handling?
>
> Make sure the guarded code is 'nothrow', and it should work.
It doesn't right now, and exceptions can be thrown at any time basically.
scope(success) seems like a better choice here, but I'm not sure of the
generated code for it.
More information about the Digitalmars-d
mailing list