|
Boost : |
Subject: Re: [boost] Boost and exceptions
From: Ulrich, Dirk (dirkude_at_[hidden])
Date: 2012-06-18 07:35:12
Mathias Gaunard <mathias.gaunard <at> ens-lyon.org> writes:
>
> On 17/06/2012 12:45, Dirk Ulrich wrote:
>
> > I am working on a C++ based project which forbids the usage of C++
exceptions
> > but it is still preferable to use Boost libraries at least the ones which do
> > not make use of C++ exceptions at all.
>
> All Boost libraries should work with exceptions disabled, with
> potentially limited functionality. If that is not the case, it's
> probably a library-specific bug that should be reported.
>
> If exceptions are disabled, Boost will call
> boost::throw_exception(std::exception const&), which must be defined by
> the user.
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
I understand that Boost provides a possibility to disable the usage of C++
exceptions and instead it provides a callback (boost::throw_exception()) which
clients can implement to catch any
exception thrown.
But that's not what i was looking for. I was more looking for a list of
libraries which have kind of
a "noexcept" guarantee (which would not even call boost::throw_exception())
because their service is either fully at compile
time or simply has no exceptional cases (as i would expect from Boost.Units for
example).
Furthermore i wonder what the implementation requirements for implementation
boost::throw_exception() are (sorry, i could not find
any documentation yet). When looking at the Boost code it seems that it is not
expected for boost:throw_exception() to return
but to abort the program immediately. Is that correct?
I also wonder how Boost handles allocation using new() in case of exceptions
being disabled. In this case the new() operator is expected
to return a NULL pointer instead of throw std::bad_alloc but i could not find
code that tests pointers against NULL at places where allocations
were done (i saw that Boost makes use of allocators instead of using plain new()
but that should probably be the same).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk