[RFC] Throwing an exception with null pointers

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Apr 16 18:43:50 UTC 2025


On 17/04/2025 6:38 AM, Walter Bright wrote:
> The correct solution is to restart the process.
> 
> The null pointer dereference could be a symptom of a wild pointer 
> writing all over the process space.

Yes, we are in agreement on this situation.

.net has a very strong guarantee that a pointer can only point to null 
or a valid instance of that type.

The restrictions that @safe place on a function does remove this as a 
possibility in D also.

And this is where we are diverging, there is a subset which does have 
this guarantee, that it does indicate logic error, and not program 
corruption.

This is heavily present in web development, but rather rare in 
comparison to other types of projects.



More information about the Digitalmars-d mailing list