The Rust reference states:
- The following is a list of behavior which is forbidden in all Rust code, including within unsafe blocks and unsafe functions:
- Dereferencing a null/dangling raw pointer
This question is solely about the null part. There's no inherent reason to require that a definite but unknown address in an address space be made inaccessible. That's my thesis (it's what most implementations of the null pointer do), so why is Rust following in these footsteps since it seems merely ancient C cruft?
I've heard several stories (example, another, another) in my career where there was a need to access such a pointer, so why allow the spec (and hence, implementations) to get in the way again?
There's assembly output and a lot of context in the C++ Reddit thread from which this question stems. It was also brought up in this Rust Reddit thread.
Despite the many "war stories" referred above, what is really upsetting for me is not in that realm, but more on the abstract one: making address space access (which is delivered by the hardware) non uniform from a language's specification, a priori to all hardware/OS/architectures it may ever be used for.