Re: [boost] compiling boost without exceptions
(Boost.All,Boost.SmartPtr)
by Peter Dimov other posts by this author
Aug 9 2002 2:15PM messages near this date
Re: [boost] compiling boost
withoutexceptions(Boost.All,Boost.SmartPtr)
|
Re: [boost] compiling boost without exceptions
(Boost.All,Boost.SmartPtr)
From: "Lars Gullik Bjønnes" <larsbj@[...].net>
>
> We are currently compiling LyX without exceptions and are thus
> required to also compile Boost libs without exceptions. Some of the
> boost libs already have preprocessor switches to accomplish this, and
> some don't.
>
> LyX does not use every Boost lib in exsistance so this patch will be a
> bit limited.
>
> However... We have decided that whenever a Boost lib would throw we
> will assert instead. We realize of course that this is not the best
> solution in all cases, but can be made to work with some extra effort
> in almost every situation.
>
> Anyway, this is the current difference between "LyX Boost" and the
> Boost CVS for us to accomplish this. The user.hpp are mostly for
> reference, apart from the BOODT_NO_EH_ASSERT macro, with is modeled on
> the similar macro in Boost.Regex.
I propose the following alternative to your patch:
* New header boost/throw.hpp:
#ifdef BOOST_NO_EXCEPTIONS
#include <exception>
void boost_throw(std::exception const & e); // user defined
#else
template<class E> void boost_throw(E const & e)
{
throw e;
}
#endif
* shared_count changes:
- if(use_count_ == 0 && weak_count_ != 0) throw use_count_is_zero();
+ if(use_count_ == 0 && weak_count_ != 0)
::boost_throw(use_count_is_zero());
and similarly for the other occurence:
+#ifndef BOOST_NO_EXCEPTIONS
try
{
pi_ = new counted_base_impl<P, D> (p, d, 1, 1);
@@ -244,6 +248,10 @@
d(p); // delete p
throw;
}
+#else
+ pi_ = new counted_base_impl<P, D> (p, d, 1, 1);
+ if(pi_ == 0) ::boost_throw(std::bad_alloc());
+#endif
Comments?
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Lars Gullik =?iso-8859-1?q?Bj=F8nnes?=
Lars Gullik =?iso-8859-1?q?Bj=F8nnes?=
Lars Gullik =?iso-8859-1?q?Bj=F8nnes?=
Peter Dimov
Lars Gullik =?iso-8859-1?q?Bj=F8nnes?=
Peter Dimov
David Abrahams
John Maddock
David Abrahams
Peter Dimov
Peter Dimov
Rob Stewart
David Abrahams
Fernando Cacciola
Jeremy Siek
Peter Dimov
Peter Dimov
Fernando Cacciola
Rene Rivera
John Maddock
Rene Rivera
Peter Dimov
Fernando Cacciola
David Abrahams
David Abrahams
Rob Stewart
David Abrahams
David Abrahams
|