4 ms·
You only end up with them in the final program with a naive translation that makes life hard for yourself. Using the native types is much nicer (even ignoring a
by dbaupp 9y ago
You only end up with them in the final program with a naive translation that makes life hard for yourself. Using the native types is much nicer (even ignoring any safety benefits), and so people are naturally encouraged to do so. For instance,
- the C interface can easily be thin wrappers around pure "nice" Rust functions, that just do the necessary unsafe conversions
- and, whether or not that is used, when a function is no longer being called from C (that is, everything that calls it has been converted to Rust) the arguments can be switched to something more natural and strong static typing will point out all the places that need to be updated.
I cannot believe that a pure Rust codebase would want to be passing raw pointers around. And the alternatives don't seem at all better: only ground-up complete-rewrite migrations (hard to justify so often won't even start) or not migrating at all (meaning one has a C codebase that is still full of unsafe pointers).