Is there any system in actual use where actually dereferencing a null
pointer will not cause an exception? I mean, _sure_, the C spec says the
result is "undefined", but isn't this just a leftover from the "bad old
days", like also supporting non-byte-addressible machines (with
non-power-of-two word size!), and other such horribleness?

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.


On Sat, Sep 7, 2013 at 6:55 PM, Patrick Walton <[email protected]> wrote:

> On 9/7/13 8:39 AM, Oren Ben-Kiki wrote:
>
>> I have a feeling that there is a non-trivial amount of code which is
>> "actually safe" but would impossible to convince the compiler it is
>> "statically safe". Surely having run-time safety in such cases is better
>> than none at all...?
>>
>
> I would be fine with this, but one big problem is that null pointer
> dereferences are undefined behavior in LLVM.
>
> Patrick
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to