3 ms·
You can also get a buffer overflow in Python and Java by abusing their equivalents of "unsafe".
by vertex-four 10y ago
You can also get a buffer overflow in Python and Java by abusing their equivalents of "unsafe".
- sidlls 10y ago"unsafe" in Rust isn't abuse. It's explicit syntax with compile time effects specifically for the purpose of facilitating unsafe constructs, like direct memory buffer manipulation, required for low level programming. I've never tried the Python or Java equivalents and frankly don't know enough about them to even know whether your comment is accurate or not.
- foota 10y agoTrue that unsafe isn't considered too wrong in rust, but auditing the small amount of unsafe code is much easier than all the code.
- vertex-four 10y agoJava has `sun.misc.Unsafe`, and Python has the FFI which is remarkably easy to misuse. The point is that you don't use these unless you need to, and you spend special effort when you do - same as `unsafe` in Rust. The rest of your code runs perfectly safely, and the vast majority of code has no need to use `unsafe`. Code which uses `unsafe` and isn't obviously either directly an FFI wrapper or a straightforward implementation of a generic data structure is generally considered bad form.