Memory safe in D

Alex akornilov.82 at mail.ru
Mon Mar 11 20:14:01 UTC 2024


On Monday, 11 March 2024 at 19:43:33 UTC, Steven Schveighoffer 
wrote:
Hello, Steven!

Thank you for clarifications!

> The explanation is that D is expecting the memory hardware to 
> fault when you dereference null.

Ok, got it, but on Windows I observe stange behaviour in runtime: 
application terminated without system error and any logs in 
console. In this case I think developer can't localize and 
figured out what is going wrong in code.

> Not assuming this behavior means all dereferences of 
> pointers/classes in @safe code would have to be instrumented 
> with a check, slowing down the code significantly.

I agree that checks on each pointer dereferences maybe expensive 
in runtime. But from my point of view solution is disable any 
null refernces in code. The compiler can do it during compilation 
and validation in runtime won't be needed.


More information about the Digitalmars-d mailing list