3 ms·
Do you know what a panic is? C will actually read arbitrary memory, Rust won't, that's the difference. We're talking about a situation where the length of the
by leshow 10y ago
Do you know what a panic is?
C will actually read arbitrary memory, Rust won't, that's the difference.
We're talking about a situation where the length of the array is not statically known and you access it out of bounds at runtime. Rust checks first if it's out of bounds, and if it is, DOES NOT blindly read the memory anyway (as C would) but exits.
I don't understand how you could think the two situations are at all equivalent.