Scope failure is not preventing application crush in case of uncaught exceptions

Anonymouse asdf at asdf.net
Sun Dec 17 00:10:27 UTC 2017


On Saturday, 16 December 2017 at 21:56:49 UTC, Jonathan M Davis 
wrote:
> The only way to catch an exception is with a catch block, and 
> if you do

If you return inside a scopeguard though, the exception (or 
error!) is swallowed. https://run.dlang.io/is/GEtQ6D

void main()
{
     foo();
     writeln("no error!");
}

int foo()
{
     scope(failure) return -1;
     assert(0);
}


More information about the Digitalmars-d-learn mailing list