News for hackers. Stuff that matters.
Re:Memory Safety in a Modern System Programming Language Pt. 1 by oconnor663 on Thursday June 23, 2022 @03:39AM (#31846172)
I'm not sure about D's situation specifically, but one issue with null ptr dereferences in C, C++, and (unsafe) Rust is that they're UB by definition, so you're at the mercy of the optimizer if it can ever prove that you're dereferencing null. This has led to some interesting security issues in the past: https://lwn.net/Articles/342330/
Re:Memory Safety in a Modern System Programming Language Pt. 1 by dukc on Thursday June 23, 2022 @05:40AM (#31846830)
An optimiser may not treat null-dereferencing D code as undefined behaviour. It must either error at compile time (if it can prove the dereference would be null no matter what), crash at runtime, or derefer the null address, which also results in a crash.