Closed mexus closed 2 years ago
So, if we consider "null pointers ⊂ dangling pointers", the latter sentence should be reworded as you suggested. Let's trace the history. The latter one was written in https://github.com/rust-lang/nomicon/commit/98a71fde9fdff9641b1bb6a23c90d49f7267c37f, the wording was already confusing as we considered "null pointers ⊂ dangling pointers" in other places (see also some other rewording commits in the related PR). But rewording the latter might be confusing as "dangling pointers" generally, AFAIK, don't contain "null pointers". cc @RalfJung you are the original author of it, any thoughts?
I think it would be reasonable to say that the null pointer is dangling... or are you saying that is not standard terminology? I never thought much about this, TBH.
or are you saying that is not standard terminology?
No I don't think (TBH, I'm not sure) it's standard, but after some googling, I think some may want to distinguish "dangling pointers" from "null pointers" from the point of view of "whether it was valid, i.e. pointing to an actual place before". Anyway, if it's not confusing, I'm happy to reword the part as Denis suggested (dangling is the same as "non-null" "null").
I think some may want to distinguish "dangling pointers" from "null pointers" from the point of view of "whether it was valid, i.e. pointing to an actual place before".
But then what about pointers like 16 as *const i32
, that are neither null nor have they pointed to an actual place before?
Hmm, I'm not sure, TBH. Anyway, I'm going just to reword it as mentioned above, I think it's the best way here.
https://github.com/rust-lang/nomicon/blob/0c7e5bd1428e7838252bb57b7f0fbfda4ec82f02/src/what-unsafe-does.md
Here's a paragraph that caused my confusion:
So, the first sentence states:
And the sentence about an empty span states:
Isn't there a contradiction? Shouldn't it be more like "is the same as null" or "non-danling" in the latter sentence?
Or am I missing something?
Thanks!