Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-12-16 14:16:42


On 12/16/16 11:05 AM, Niall Douglas wrote:
> 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:

My suggestion was to ignore the whole issue and assign it some other
library/component. A couple libraries use the idiom similar to

template MyTemplate<class T some_type, class E error_handler =
boost::throw_exception>

This decouples the error handling from the functionality of the library
itself and permits the user to unificate his error handling across
libraries. It also avoids the necessity of coordinating error handling
across libraries in time and space. In this particular case stacktrace
would provide the mechanism to invoke/serialization or whatever a stack
trace and it would be job of the library/application which uses it to
decide when to invoke it.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk