Is there a modern language with ABI stability that can replace C for that? As in, you can wrap anything with a C API and be sure that it can be called from any other language easily?
Is there a modern language with ABI stability that can replace C for that? As in, you can wrap anything with a C API and be sure that it can be called from any other language easily?
Two C implementations on the same CPU with 64-bit integers both, unsurprisingly, think 64-bit integers work the same way - because that was obvious. Now, how about 128-bit integers. Ah, turns out implementation A thought they go (lo,hi) but B thought they're obviously (hi,lo) so these types have different ABI between C implementations...
It's not obvious because most software which cares about Windows also needs the Windows API and so couldn't be non-Windows software, but Windows people have a different rule for how 64-bit works than everybody else, LLP64 versus the usual LP64. And there were other options such as ILP64 they're just all basically dead.
Also ABI compatibility isn’t part of the C specification. Most implementers use System V ABI compatibility guidelines. Many compilers can output code for different ABI’s calling conventions. There’s more than one! Which you use depends on how crufty the code is and on the platform you are using.
I think the big advantage of C like languages here is the plethora of implementation defined platforms. That’s a huge network effect. If you want to target the 6502? There’s a compiler for it. Some chip you’ve never heard of? Probably some fork of GCC that targets it. Want to call some library function in some foreign binary written in a completely unknown language? If you can finagle the bytes and reverse engineer the calling conventions you can do it with C.
I think it might be that C does leave so much out of the specification and up to the implementation and platform that makes it unique and useful at times.