This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch-rfc] N2179: Exception Propagation in C++


Paolo Carlini wrote:
Before finally applying the patch, I'd like to ask you a final courtesy: I tried to catch up with the discussion which took place on the cxx-abi mailing list, and, as I feared, it quickly becomes rather technical... Could you please summarize the abi compatibility features of the current implementation? Essentially, I just want to make sure that binaries built vs the old library (headers) still works fine when relinked vs the new library .so. Also, that old binaries and binaries built with the new library and not using the new features can interoperate when linked to the new .so.
OK, it works like this: whether the new or the old exceptions are used depends entirely on the linked library. The new library creates new exceptions and can handle new exceptions, whereas the old library creates old exceptions and can handle old exceptions. The differences are not visible to user code, which means that for code not using the new features it doesn't matter against which library it links.

Problems arise only if there are multiple conflicting versions of the library in a loaded image, e.g. when an executable statically linked against libsupc++ loads an .so that loads libstdc++ dynamically, and the libstdc++ is new, *and* exceptions travel between the two parts. I haven't tested the specific behaviour of this case, but from my understanding of the code, there are two options:
1) New code creates exception, old code catches it. This should actually work, unless the new exception was thrown with rethrow_exception(). In that case, the exception would be treated as foreign and could be caught with catch(...), but nothing else. If it's a normal exception, I don't see anything going wrong.
2) Old code creates exception, new code catches it. This will work, unless the new code tries to call current_exception(), which would lead to an access violation or silent data corruption (the code would try to increment a reference count that's not there).


So, nothing bad should happen even when mixing libraries, but I wouldn't want to rely on that.

However, the interoperation of old code with the new library and vice versa should be completely unproblematic.

Sebastian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]