3 ms·
Nitpick: `std::ptr::null()` is not just there for C interop. It's also useful when writing pure Rust unsafe code.
by yberreby 10y ago
Nitpick: `std::ptr::null()` is not just there for C interop. It's also useful when writing pure Rust unsafe code.
- Gankro 10y agoCan confirm, used null all the time in Rust. The raw pointers are important native Rust constructs, although they do skew to supporting C idioms as much as possible (e.g. `* const T` and `* mut T` is basically a worthless distinction within Rust itself).
- sdegutis 10y agoSo in other words, std::ptr::null is Rust's version of null for situations where you would actually use null in C, except in general Rust discourages trying to use it like it's C. Seems reasonable.