Live data from Hacker News

ABI – Now or Never [pdf]

open-std.org

11–20 of 37 posts

Re: ABI – Now or Never [pdf]

#11
post #4

What is the "runtime overhead involved in passing unique_ptr by value"? The reference is a 1h YouTube video.

The video: https://www.youtube.com/watch?v=rHIkrotSwcc

I wrote up a reddit post for a possible workaround for removing the overhead. It's standard C++, no ABI break is required. It's not without caveats though: https://www.reddit.com/r/cpp/comments/do8l2p/working_around_...

Re: ABI – Now or Never [pdf]

#12
post #3
post #2

Discussion of whether the next (or any future) c++ release should break abi compatibility.

Does C++ have an ABI?

C++ doesn't but Windows C++ does, to the extent it's implicitly used for things like COM. Any breaking change would have to be managed carefully.

Re: ABI – Now or Never [pdf]

#13
post #4

What is the "runtime overhead involved in passing unique_ptr by value"? The reference is a 1h YouTube video.

Short version: it passes a pointer to the pointer forcing a double indirection rather than a single. Simple attempts to fix don't really work. Not even sure an ABI break will be enough, but it would at least be a minimum requirement.

The standard would probably need to introduce destructive move semantics and trivially relocatable types (unique_ptr for example) to enable simplifying the ABI for such types. Then of course an ABI break is required to actually apply the changes.

Re: ABI – Now or Never [pdf]

#14
post #3
post #2

Discussion of whether the next (or any future) c++ release should break abi compatibility.

Does C++ have an ABI?

All platforms have a standard ABI. Windows' (more specifically, MSVC's, as mingw g++ does not follow it) is mostly undocumented, but substantial portions are reverse-engineered. Most other platforms use some modification of the Itanium ABI, which describes the ABI in terms of a C structs and functions. ARM uses Itanium, with a somewhat different mechanism for exception handling.

Re: ABI – Now or Never [pdf]

#15
post #3
post #2

Discussion of whether the next (or any future) c++ release should break abi compatibility.

Does C++ have an ABI?

It doesn't have a standard ABI.

Nevertheless, certain language changes can force a breaking change to any existing ABI (or even all of them, and the C++ committee does not work in a vacuum. They work with existing implementations and must agree with implementers before making changes to the standard.

For example, there was a change to the definition of std::string in C++11 that forced a break in all commonly used ABIs (MSVC, Itanium at least). This was deemed necessary, but the cost of it to real-world programs has proven higher than anticipated, and may be a regretted decision (it apparently still causes problems and requires special flags even today).

Re: ABI – Now or Never [pdf]

#16
post #4

What is the "runtime overhead involved in passing unique_ptr by value"? The reference is a 1h YouTube video.

Short version: it passes a pointer to the pointer forcing a double indirection rather than a single. Simple attempts to fix don't really work. Not even sure an ABI break will be enough, but it would at least be a minimum requirement.

Makes me wonder why anybody takes them by value, and not by rvalue-reference.

But unique_ptr in public interfaces feels like code smell. I have done it, but not proudly.

Re: ABI – Now or Never [pdf]

#17
post #12
post #3

Earlier quoted context omitted.

Does C++ have an ABI?

C++ doesn't but Windows C++ does, to the extent it's implicitly used for things like COM. Any breaking change would have to be managed carefully.

On the contrary one of the reason of COM is to not depend on the C++ ABI, which is not stable at all under Windows (it has been de-facto stable for the three last version of MSVC, but was broken each time before, and the recent stable stride is not an indication this ABI compat will continue - actually it is well known that MS internally maintains an ABI incompat version of the STL that will be very probably used in the future, to fix some issues and optimize things)

On another platform, libstdc++ is mostly backward compatible, within reason.

The C++ standard is not "officially" concerned by stability, except that in practice people in the committee care a lot (because some major implementations care a lot) so some modifications are rejected because they would break the ABI currently used in practice.

Re: ABI – Now or Never [pdf]

#18
post #17
post #12

Earlier quoted context omitted.

C++ doesn't but Windows C++ does, to the extent it's implicitly used for things like COM. Any breaking change would have to be managed carefully.

On the contrary one of the reason of COM is to not depend on the C++ ABI, which is not stable at all under Windows (it has been de-facto stable for the three last version of MSVC, but was broken each time before, and the recent stable stride is not an indication this ABI compat will continue - actually it is well known that MS internally maintains an ABI incompat version of the STL that will be very probably used in…

You don't get a stable ABI by accident. MS chose to maintain stability on these recent releases. This is a change from past practice, in response to customer needs.

Customers who needed stability were staying on ancient compilers. MS probably would rather have them using new versions, and exercising new features.

Re: ABI – Now or Never [pdf]

#19
C++ ABI issues seem to be in this paradoxical situation where the language standard powerbrokers simultaneously feel that

a. Having a real binary compatibility story is beneath C++, but

b. The accidental ABI compatibility that exists today is too widely adopted to break.

Re: ABI – Now or Never [pdf]

#20
post #17
post #12

Earlier quoted context omitted.

C++ doesn't but Windows C++ does, to the extent it's implicitly used for things like COM. Any breaking change would have to be managed carefully.

On the contrary one of the reason of COM is to not depend on the C++ ABI, which is not stable at all under Windows (it has been de-facto stable for the three last version of MSVC, but was broken each time before, and the recent stable stride is not an indication this ABI compat will continue - actually it is well known that MS internally maintains an ABI incompat version of the STL that will be very probably used in…

In regards to COM I was specially thinking about how virtual functions and methods are layed out. This cannot change without breaking a lot of code. Already this causes issues in non-C++ languages (e.g. the difference with thiscall in C++).
Post reply on HN