On Sat, Sep 7, 2013 at 12:09 PM, Oren Ben-Kiki <o...@ben-kiki.org> wrote:

> If in practice on any machine today (X86, ARM, PowerPC, MIPS, SPARC, ...)
> every null pointer will fault (which I strongly hope will...), then I'd be
> quite happy in saying formally that accessing a hole leads to "undefined
> behavior" and make good use of knowledge that any such access will, in
> fact, fault, on any machine I might be coding to today.
>

You get a segmentation fault on Linux because the first page is marked
read-only for userland processes. It's valid on almost any hardware to
dereference a pointer equal to zero, which is how LLVM defines the null
pointer. However, LLVM explicitly considers a dereference of the null
pointer to be undefined behaviour so it doesn't matter how it could or
couldn't be implemented in hardware.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to