dereferencing null
Nathan M. Swan
nathanmswan at gmail.com
Mon Mar 5 22:38:36 PST 2012
On Tuesday, 6 March 2012 at 06:27:31 UTC, Jonathan M Davis wrote:
> scope(failure) is _not_ guaranteed to always execute on
> failure. It is _only_
> guaranteed to run when an Exception is thrown. Any other
> Throwable - Errors
> included - skip all finally blocks, scope statements, and
> destructors. That's
> one of the reasons why it's so horrible to try and catch an
> Error.
Maybe not guaranteed, but this happens:
code:
import std.stdio;
void main() {
scope(failure) writeln("bad things just happened");
int[] x = new int[4_000_000_000_000_000_000];
}
output:
bad things just happened
core.exception.OutOfMemoryError
More information about the Digitalmars-d
mailing list