dereferencing null

Adam D. Ruppe destructionator at gmail.com
Sat Mar 3 19:29:27 PST 2012


On Sunday, 4 March 2012 at 03:15:19 UTC, Sandeep Datta wrote:
> All we have to do now is provide a more specific exception (say 
> NullReferenceException) so that the programmer has the ability 
> to provide a specific exception handler for 
> NullReferenceException etc.

Looks like it is pretty easy to do. Check out

dmd2/src/druntime/src/rt/deh.d

The Access Violation error is thrown on about
line 635. There's a big switch that handles a bunch
of errors.

> I gave it a try on Linux but unfortunately it leads to a 
> segfault

Yeah, Linux does it as a signal which someone has
tried to turn into an exception before, which kinda
works but is easy to break. (I don't remember
exactly why it didn't work right, but there
were problems.)


More information about the Digitalmars-d mailing list