Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Most of the time, you'll be accessing Rust collections through iterators, and iterators fold the bounds-check into the termination condition. There's no additional overhead here; it compiles into the exact same code that the C would.


If you're using iterators, you don't have to worry about buffer overflow. But every A[i] random access needs to be bound checked.


Although the bounds check can also be elided if the compiler knows i < len


Right. I think that's mostly immutable containers though, right? Or is the compiler smarter than that?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: