scope(exit) without exception handling?

Timon Gehr timon.gehr at gmx.ch
Wed May 16 14:05:07 PDT 2012


On 05/16/2012 08:59 AM, Walter Bright wrote:
> 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.

Doesn't that imply that 'in'-contract checking might leave the program 
in an invalid state?


More information about the Digitalmars-d mailing list