3 ms·
In practice, there is a stable and standard ABI in C++. On Windows systems, you use the (undocumented, but mostly reverse-engineered) MSVC ABI. On everybody els
by jcranmer 7y ago
In practice, there is a stable and standard ABI in C++. On Windows systems, you use the (undocumented, but mostly reverse-engineered) MSVC ABI. On everybody else, you use the confusingly-named Itanium ABI, except for exception handling on ARM, which uses a slightly different ABI.
Standard library implementations do not necessarily share the same ABI, but it is possible to interoperate between libc++ and libstdc++, and libstdc++ maintains ABI compatibility across different versions.
And, to be pedantic, C does not provide a stable, standard ABI. It is the platforms themselves that provide this ABI standard, and these platforms equally provide a C++ ABI standard. So C++ ABI compatibility is no more or less a problem than C ABI compatibility.
- pjmlp 7y agoJust a small correction macOS derived platforms do it a bit differently as well.
- paulddraper 7y agoThe legitimate difference between C and C++ ABIs is that the C ABI is easier to understand and reason about. It's analogous to Java and Scala; each has an ABI, but it's easier to tell when the former breaks ABI than the latter.
- likeliv 7y agoThat's right. C being more limited, it has a more simplistic ABI. But the parent comment was replying the "need for a stable, standard ABI, which C provide". Which is misleading as both C++ and C have the same level of stability and standardisation of their ABI. (I.e: none of them is standardized, but both of them are stable on practice)
- paulddraper 7y agoYep, you're right. There is a difference, but the difference is in complexity, not availability.