On 12/16/16 22:05, Niall Douglas wrote:
On 15 Dec 2016 at 16:00, Emil Dotchevski wrote:
Do you mean a run-time hook or a compile-time hook?
I think this should be compile-time hook in order to avoid the perils of dynamic initialization in complex multi-thread programs. But we already have that compile-time hook, it's called boost::throw_exception.
Firstly thanks to all for the detailed discussion. Bringing it back to the review of Stacktrace which this is (and not of Exception, another discussion thread would suit that), I am seeing the following options proposed for Stacktrace:
Option 1: That Stacktrace implement a macro like BOOST_STACKTRACE_THROW_EXCEPTION() which reimplements BOOST_THROW_EXCEPTION() but with muxed in stacktrace.
Option 2: That Stacktrace optionally hook some compile time hook in Boost.Exception to mux in stacktrace.
Option 3: That Stacktrace optionally hook some runtime hook in Boost.Exception to mux in stacktrace.
Option 3 or 3+1 (i.e. the runtime hook is used by a new macro) look the most preferable to me.
Implied in all the above is that the exception type stacktrace mux in framework as described in the current Stacktrace docs is considered bad form and should be deleted?
Frankly, I haven't yet reviewed Stacktrace, although now that I entered the discussion I probably should. I'll try to do that on the weekend. For now it seems unnecessary to have two mechanisms for injecting stacktraces. Given that we already have Boost.Exception, it seems preferable to use its facilities.