Asserts inside nothrow function

downs default_357-line at
Mon May 25 04:33:18 PDT 2009

Denis Koroskin wrote:
> I just started using nothrow functions a little bit and came across the
> following issue.
> Some of the functions that I'd like to mark as nothrow have debug
> asserts inside them.
> They used to throw an Exception, but I'd like to change their behavior
> and terminate an application whenever an assertion fails inside a
> nothrow function.
> It's not very handy to write
> try { assert(condition, errorMessage); } catch { abort(); }

Um .. am I missing something here?

void check(bool condition, lazy string msg) { if (!condition) { printf(/* print msg here */); abort; } }

More information about the Digitalmars-d mailing list