Make function nothrow

ref2401 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 28 08:05:23 PST 2016


There are functions in Phobos that do not throw but they are not 
marked as `nothrow`.
When I need to call them from my `nothrow` code I do this:

void foo() { /* I won't throw, honestly. */ }

void bar() nothrow {
	scope(failure) assert(false);
	foo();
}

The question is: Is it ok to do such thing or should I just stick 
with try {} catch() {}?
Thank you.



More information about the Digitalmars-d-learn mailing list