Throw in a pre-condition of a nothrow function
bearophile
bearophileHUGS at lycos.com
Fri Mar 8 11:39:45 PST 2013
Currently this code compiles:
void foo() nothrow
in {
throw new Exception(null);
} body {
}
void main() {
foo();
}
Then at runtime throws:
object.Exception at test.d(3)
---------
0x00402044 in nothrow void test.foo() at ...
...
Is this good? Isn't the "nothrow" tag used by the compiler to
better optimize functions?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list