diff --git a/abi-eh.html b/abi-eh.html index d7ad49f..b7e8d7f 100644 --- a/abi-eh.html +++ b/abi-eh.html @@ -2077,6 +2077,52 @@
3.4.1 Allocating the Exception Object
its buffers before acquiring one. +

+ +

3.4.2 Initializing the Exception Object
+ +

+Vaguely, the process of throwing an exception consists of +three independent parts: +

    +
  1. Allocate the memory for the exception and copy user object into that memory +
  2. Set up the internal fields of the exception object +
  3. Start unwinding process +
+ +

+Sometimes it's desirable to do p.1 and p.2 with leaving p.3 for later: this is what +std::exception_ptr does.
+To better support such use cases implementors of the ABI are encouraged to provide a +__cxa_init_primary_exception function, which implements p.2.
+

+    void* __cxa_init_primary_exception (void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) );
+
+ +The arguments are: + + +Noticing the similarities of parameters of this function and __cxa_throw,
+__cxa_init_primary_exception is expected to be used as a subroutine of __cxa_throw. + +

+ +Collaboration between __cxa_init_primary_exception() and +whichever way std::rethrow_exception is implemented is necessary to handle the p.3 (deferred unwinding). + +