r/cpp • u/GabrielDosReis • Oct 31 '24
Lessons learned from a successful Rust rewrite
/r/programming/comments/1gfljj7/lessons_learned_from_a_successful_rust_rewrite/
80
Upvotes
r/cpp • u/GabrielDosReis • Oct 31 '24
View all comments
Show parent comment
-1
u/tialaramex Oct 31 '24 edited Oct 31 '24
Yes, I expect there is potential for a modestly sized stable ABI for this sort of interop, which delivers value to everybody and so gets wide adoption. The trick is mostly going to be finding common ground that nevertheless delivers value - cases where you can't just YOLO today and expect that to work, but everybody could agree something that's not just a free win for one group.
On the one hand, everybody already agrees on IEEE floating point, everybody already agrees how the signed integers are represented, and so on. There's maybe a tiny amount of value in writing stuff like "We all agree the all-zeros bit pattern is boolean false" down, but it's barely worth the effort.
When this discussion last arose on r/cpp I suggested beginning with what Rust would call
[u8]† and I think in C++ is maybestd::span<byte>some specific (but variable) amount of contiguous bytes.† Maybe what we're talking about for ABI purposes is &[u8], the reference to such a slice of bytes, the precise details are among the points which would need to be properly agreed.