dereferencing null

Adam D. Ruppe destructionator at gmail.com
Sat Mar 3 19:01:03 PST 2012


On Sunday, 4 March 2012 at 02:53:54 UTC, Sandeep Datta wrote:
> Thus the inability of handling such exceptions undermines D's 
> ability to support dynamically loaded modules of any kind and 
> greatly impairs modularity.

You can catch it in D (on Windows):

import std.stdio;
void main() {
	int* a;
	try {
		*a = 0;
	} catch(Throwable t) {
		writefln("I caught it! %s", t.msg);
	}
}

dmd test9
test9
I caught it! Access Violation



More information about the Digitalmars-d mailing list