Scope Guard Example #2

Code



Application output:

Yes, multiple scope guards of the same type can be declared. And this scope( exit ) will execute before the one above. I'm always going to execute. Because I'm the first scope guard in this scope. And the scope doesn't exit before I am declared. But I will be the last scope guard to run.


Application error:

object.Error: No scopes declared after me will execute. ---------------- ./f209(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x43d2d4] ./f209(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x43ce06] ./f209(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x40) [0x43d324] ./f209(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x43ce06] ./f209(_d_run_main+0x1ae) [0x43cdc2] ./f209(main+0x17) [0x43cc0f] /usr/lib/libc.so.6(__libc_start_main+0xf5) [0x40967a15] ----------------

Paste info


Author: Guest
Views: 1489
Private: no
Expires: Never
Uploaded: 03.11.13 16:02
Tags: scope guard
Votes: 1

Compilation


Compiler: DMD 2.063
Pointer size: m64