Enhancements can enable memory-safe reference counting

IGotD- nise at nise.com
Thu May 27 22:34:53 UTC 2021


On Thursday, 27 May 2021 at 22:13:30 UTC, tsbockman wrote:
>
> As Paul Backus said earlier, dereferencing a `null` pointer is 
> formally considered to be memory-safe in D. This is because it 
> will (with some rare exceptions) crash the program immediately, 
> rather than corrupting memory and continuing execution with 
> undefined behavior.

That's "memory-safe" in any language in that case because that's 
a function of the operating system rather than the language. 
However, there are exception like if you are dereferencing a null 
pointer + offset and the offset is large, then you can corrupt 
memory. This is more rare though.

A program crash is the best bug you can have. A core dump can be 
saved and be investigated.


More information about the Digitalmars-d mailing list