On Sunday, December 17, 2017 08:10:06 codephantom via Digitalmars-d-learn wrote: > On Sunday, 17 December 2017 at 00:10:27 UTC, Anonymouse wrote: > > If you return inside a scopeguard though, the exception (or > > error!) is swallowed. https://run.dlang.io/is/GEtQ6D > > The scope guard will not 'swallow' it, if you use -release mode. > > Which suggests to me, that assert(0) operates differently when > 'not' using -release mode. > > My 'guess' is, that release mode issues a halt instruction, > whereas in non-release mode it is just an exception like any > other exception.
assert(0) does indeed turn into a HLT instruction in -release mode (as does any assertion that's known to be false at compile time). It's a special case intended for marking code that's supposed to be unreachable. Without -release, failed assertions throw AssertErrors, so they're Errors not Exceptions, though I think that scope statements currently catch and then rethrow Throwable rather than Exception, which is why AssertErrors would be affected. - Jonathan M Davis