3 ms·
> Our modern software empire is built on mountains of C, and deference to C is pervasive throughout higher-level software design. This I agree with and also I'
by geofft 8y ago
> Our modern software empire is built on mountains of C, and deference to C is pervasive throughout higher-level software design.
This I agree with and also I'd call the most important reason for Rust programmers to learn C. The C ABI is a lingua franca, not because it's good or pure but (as with spoken linguas franca) happened to be in the right place at the right time. It defines certain conventions and assumptions that didn't have to be assumed (implicit stack growth without declared bounds, single return value, NUL-terminated strings, etc.) and a lot of software is written to it, to the point that if you want your (e.g.) Python code and Rust code to interoperate, the easiest way is to get them to both speak C-compatible interfaces, even though you're not writing any actual C code.
- ElijahLynn 8y agoFor those who don't know what ABI means (as I did not) and thought it might be a typo. ABI = Application Binary Interface https://en.wikipedia.org/wiki/Application_binary_interface https://en.wikipedia.org/wiki/Application_binary_interface https://upload.wikimedia.org/wikipedia/commons/b/bb/Linux_API_and_Linux_ABI.svg https://upload.wikimedia.org/wikipedia/commons/b/bb/Linux_AP...
- geofft 8y agoYup. In compiled-languages land it's common to see things that are API-compatible but not ABI-compatible: the compiled objects don't work together, but if you recompiled the same source code it would work with no changes. This happens (sometimes) when you do things like reorder members of a structure or switch to a larger integer type for the same variable. C and libc have been ABI-stable on most platforms for decades. C++ on some platforms (e.g., GNU) is stable with occasional ABI breakages in the standard library; on others (e.g., MS Visual C++) it breaks with new compiler versions. Rust isn't ABI-stable at all and has no clear plans for it, despite a strong commitment to API stability (i.e., old code will compile on new compiler versions). Swift 5 is targeting ABI stability.
- Sir_Cmpwn 8y agoTo save you the read: in web terms, the API is e.g. Stripe and the ABI is HTTP.
- umanwizard 8y agoThere is not really any such thing as "the" C ABI -- different platforms have totally different conventions, even on the same instruction set.
- saagarjha 8y agoI'm assuming "the" C ABI probably means System V.
- jdub 8y agoIt's shorthand for "the ABI relevant to the current context", which is entirely reasonable.
- umanwizard 8y agoIt wasn't at all clear to me from the post I responded to that this is what the poster meant, or that they knew the fact I was stating.