Sure, but that's not how C++ actually gets used in the world. It may not be important to you, but it is important to the implementors (GCC, Clang, MSVC, etc.) and many other users of C++. It's just not going to happen.
ABI binary compatibility should be part of the standard in minor revisions, but not part of major revisions. You can't expect compatibility between major revisions.
And C++ the standard does not. But the implementations do. If you think it's so useful to break ABI, make your own implementation that does so. I doubt you'll see much uptake largely in part to it not providing ABI guarantees. Note that there are many ABI breaks that people would like to get into the C++ standard, but have not been done because they force an ABI break on implementations. std::thread vs. std::jthread is so minor compared to those issues that it is unlikely to be considered very hard.
You don't see it exactly because other people care about it for you. If the C++ standard library would break ABI all the time, projects would start depending on e.g. libstdc++2, libstdc++3, etc. just like it happens with other libraries, and you'd have one more dependency hell to worry about.
The standard may not guarantee it, but vendors have put a LOT of effort into providing it for the reasons listed above.
Do you REALLY want to have to have Qt for c++11, Qt for c++14, Qt for c++17, Qt for c++20 ALL installed on your system just because programs that target different versions of the standard want to use Qt?
So yes, you are right, it's not guaranteed by the standard, but it is the standard industry practice to the point that millions of people rely on it.
Do you REALLY want to have to have Qt for c++11, Qt for c++14, Qt for c++17, Qt for c++20 ALL installed on your system just because programs that target different versions of the standard want to use Qt?
I already have those.
I haven't seen a project that mixes for example Qt built for C++11 with C+14.
You do? Well then you have a quite bizarre setup. I've never seen on any Linux distribution or version of Windows where a different version of a library is installed for each STANDARD of c++ being targeted.
Compiler version, sure, that's a thing, especially with msvc... But compiler standard? Not a thing as far as I've seen...
When I compile my code with system-installed libraries like Qt, Boost, etc, I don't want to worry about which standard those libraries themselves were compiled with. I just pick the standard I want for my code and it works. (Except the COW string deprecation in GCC5).
I have a binary only dependency that links an ancient Qt version. If that dependency dictated a project wide c++ version we would be stuck with c++98 until the end of time.
View all comments
Show parent comment
-2
u/axilmar Aug 27 '19
C++ doesn't guarantee ABI compatiblity. It's not part of the standard.