Re:The Git source code audit, viewed as a Rust programmer
by marcosdumay on Wednesday January 25, 2023 @03:30PM
(#34523762)
Well, yes. I favor your program blowing up on integer overflow too, so it's very predictable how it behaves. And if it's not overflow that is the concern here, well, it's not solved by going with another type either.
Almost all the time, usize has a convenient limit that is much larger than needed. On the few exceptions, yes, you have to design your types and deal with type conversions.
That's a fair point, and I've seen here on HN a design approach that everything should have a limit (because programs often explode in unexpected ways, such as degraded performance, when operating outside the programmer's expectations)
But, usize doesn't necessarily capture the right limit, so.. I'm not sure