4 ms·
> I find it strange that this design forces you to use a single exception type, std::error, for everything you want to throw with the new mechanism. I actually
by Rusky 8y ago
> I find it strange that this design forces you to use a single exception type, std::error, for everything you want to throw with the new mechanism.
I actually kind of like the idea. It ensures that error returns will be a fixed, small size, which enables the proposed ABI changes; and allows for attaching arbitrary information through std::exception_ptr, which avoids the need for checked exceptions' proliferation of error types.
- comex 8y agoThe optimized ABI doesn’t depend on there being one error type for everything. Ideally it should be usable for any function parameter or return of a type that can handle being moved with memcpy - not just errors. And indeed, in the current Clang implementation you can stick [[trivial_abi]] on any class.