On Thursday, 17 October 2013 at 23:18:21 UTC, DDD wrote:
I tried this code and the compiler allowed it (runtime I get object.Error: Access Violation). What am I doing wrong?

D doesn't consider null pointer deference to be unsafe, since its behavior is predictable (the hardware will catch it and kill the program). This btw is arguably wrong, since dereferencing a large null object can potentially overwrite other stuff, but it is how it is right now.

@safe prohibits casting ints to pointers, doing pointer arithmetic, and other similar things that can create hard to find bugs and other undefined behavior.

Reply via email to