Null references redux

Nick Sabalausky a at a.a
Sun Sep 27 07:33:43 PDT 2009


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:h9n44k$2g61$1 at digitalmars.com...
>
> Memory safety is something that can be guaranteed (presuming the compiler 
> is correctly implemented). There is no way to guarantee that a non-trivial 
> program cannot crash. It's the old halting problem.
>

No one said anything about guaranteeing a lack of *any* crash at all. But 
*some* crashes *can* be guaranteed not to occur. Specifically, a function 
that takes in a non-nullable reference 'bar' can be guaranteed not to 
exhibit a null dereference crash upon a dereference of 'bar'. And that 
guarantee can be made without making the code any more suseptable to 
corrupted state that it would otherwise be.

> BTW, hardware null pointer checking is a safety feature, just like array 
> bounds checking is.

Sure. And a runtime check to make sure a multiplication is between two 
numbers is also a safety feature...But we have a better way to handle that. 





More information about the Digitalmars-d mailing list