4 ms·
It appears the compiler optimizes out bounds checking if and only if it can tell during compile time that the index is correct [1]. Arrays of dynamic size or wi
by DCKing 12y ago
It appears the compiler optimizes out bounds checking if and only if it can tell during compile time that the index is correct [1]. Arrays of dynamic size or with dynamic references are bound checked. In dynamic cases you should be writing manual bound checking guards in C anyway.
[1]: https://github.com/mozilla/rust/issues/9024 https://github.com/mozilla/rust/issues/9024