4 ms·
I was just wondering how to do that without using 'unsafe' rust. 1. Dereferencing raw pointer is unsafe; but maybe not necessary? 2. `int main (void) { int a =
by archi42 4y ago
I was just wondering how to do that without using 'unsafe' rust.
1. Dereferencing raw pointer is unsafe; but maybe not necessary?
2. `int main (void) { int a = 1; int b = 0; int &ref = a; ref = b; return b; }`
3. union access is unsafe
4. the cost of not having nullptr or similar
Obviously a linked list is trival to implement with pointers; but at least in C++ a naive linked list implementation can easily produce lots of suffering (read: UAF or DF) with a `delete list.getPointerToElement(i)` (in practice it will be a more convoluted variant of that, maybe introduced by dozens of people working on a badly documented code base over a decade or two). I'd expect if programmers already do that in C++ there isn't much that prevent them doing that in unsafe rust?
> insane approach
I can assure you my mental health is pretty good, thanks. Though I made a comment regarding a thought experiment in a rust thread, I can see why you would think that.
- scaredginger 4y agoI feel sorry for your coworkers