Boost logo

Boost Users :

Subject: Re: [Boost-users] [Exceptions] Boost exception relationship with std exception & streams
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-06-21 01:50:12


On Sun, Jun 20, 2010 at 3:07 AM, joel falcou <joel.falcou_at_[hidden]> wrote:
> I'm about to use boost.exception in a library which may require to be built
> in environnement where using std is eitehr impossible or has huge penalty
> one may want to avoid.
>
> My main idea was to use the BOOST_THROW_EXCEPTION and the error_info to
> build
> the diagnostic infos into exception class then:
> - if BOOST_NO_EXCEPTIONS is not set, process normally
> - if BOOST_NO_EXCEPTIONS is set, then jump into a throw_exception
> function that just
> stream diagnsotic_info to cerr or some such
> - if BOOST_NO_EXCEPTIONS and NT2_NO_STREAM is set, jump to a
> throw_exception that
> fprintf the diagnostic_info to stderr

Boost Exception does support the error info functionality even in
BOOST_NO_EXCEPTIONS builds. For example, the user-defined
boost::throw_exception function can use boost::diagnostic_information.

> My question is: how deeply std elements ar eintegrated in
> boost::exception

Pretty deeply. A quick search reveals the following std:: elements
used by boost::exception:

std::string
std::map
std::pair
std::exception and the other std exception types
std::ostringstream

So I don't think it'd be easy at all to de-STL the Boost Exception
library. Also note that BOOST_NO_EXCEPTIONS builds still require the
exception types to derive from std::exception.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net