gems
"if it compiles, it works!"
>complains about how C++ is better because you need to know how to write safe code
>writes unsafe code in Rust immediately
user... maybe programming isn't for you
yeah, I've only written a bit of rust but I thought OP's example should be caught by the compiler..? what's the issue
that's a lot of words that you could have instead used to show how that breaks memory unsafety
>fails at basic static analysis and needs to rely on runtime checks
go compile C code with `-fsanitize=address`
CONGRATZ, now C is memory safe as well.
>this compiles without any warning
I mean, why shouldn't it, it's still memory-safe at runtime
I bet that e-mail probably went right over your head. Do you understand the underlying issue here, aka memory overcommitment?
Rust does catch this. Select "Tools" then "Clippy" from the dropdown in the upper left. You should always have Clippy enabled.
play.rust-lang.org
```
Checking playground v0.0.1 (/playground)
error: range is out of bounds
--> src/main.rs:10:27
|
10 | analyze_slice(&arr[0..5]); // this compiles without any warning
| ^
|
= note: `#[deny(clippy::out_of_bounds_indexing)]` on by default
= help: for further information visit rust-lang.github.io
error: could not compile `playground` due to previous error
```
Clippy detects it, but not the actual compiler for whatever reason.
This