Re:"Rust does not have a stable ABI"
by sanxiyn on Thursday August 13, 2020 @01:03PM
(#24145546)
This is an intractable problem because checking for buffer overflows requires buffer bounds and C pointers lack buffer bounds. Rust solves this by "fat pointer", pointer that knows its size, but fat pointer can't be the same size as thin pointer hence it would be backward incompatible.
[ Parent
| on HN ]
Re:"Rust does not have a stable ABI"
by dependenttypes on Thursday August 13, 2020 @03:01PM
(#24146950)
Your C implementations lacks "buffer bounds". C by itself doesn't. There is nothing stopping a C implementation tracking the size of the data that a pointer points to (and these implementations are not even hypothetical, they actually exist right now).
> hence it would be backward incompatible
Rust is backward incompatible with C. A C implementation with fat pointers would not be backward incompatible with C. Depending on how it was implemented it could be ABI-incompatible with older C implementations but this is not necessary either.
The problem fat pointer based implementations are massively slower. Rust aims to provide safety without massive performance penalties. If one wanted safety without performance they would just use java or similar.
Re:"Rust does not have a stable ABI"
by dependenttypes on Friday August 14, 2020 @08:36AM
(#24157076)
> The problem fat pointer based implementations are massively slower
I am challenging that. I do not believe that a C implementation that uses fat pointers needs to be any slower than Rust.
> If one wanted safety without performance they would just use java or similar.
Or C with a safe implementation.
Re:"Rust does not have a stable ABI"
by steveklabnik on Friday August 14, 2020 @09:28AM
(#24157647)
Yeah like, rust also uses fat pointers. They should be equivalent. The issue is pervasiveness not speed.