Re:The Git source code audit, viewed as a Rust programmer
by nextaccountic on Tuesday January 24, 2023 @12:29PM
(#34506879)
> I imagine that applications with less addressing space also have less of every other resource, and can count less of everything.
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
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.
Re:The Git source code audit, viewed as a Rust programmer
by yakubin on Tuesday January 24, 2023 @01:25PM
(#34507735)
It's sometimes good to use a smaller size. Many string/dynamic array libraries e.g. will use 32-bit types for size and capacity even on 64-bit platforms to conserve space, and by that virtue also be more cache-efficient. I think the Zig compiler also explicitly uses 32-bit types in a lot of places, even though it's targeted mostly for 64-bit platforms.
I imagine that applications with less addressing space also have less of every other resource, and can count less of everything.