Subject: Re: [boost] 5 Observations - My experience with the boost libraries
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-03-28 20:08:04
Tom Brinkman a écrit :
>> The prevailing view on projects that I have worked on is that
>> C++ exception handling should optional and not required.
>>> Exceptions are a fact of C++ life. You can't avoid them if for no other
> reason than std::bad_alloc, unless you don't allocate from the free store.
> Not true, there are no-throw versions of std::new.
> In any event, my point is that c++ exception handeling should be optional.
> Boost libraries need to be updated to reflect this.
The C++ standard library throws exceptions. You probably use it, as a
lot of other C++ developers do, while claiming things like containers of
types that don't throw exceptions don't throw exceptions, but yes, they
do (since they call operator new, which throws, and have no other way of
reporting errors anyway).
How can you expect Boost to be any different than the standard library?
Even Qt recently left no-exception-make-believe-land when they realized
it hurt them more than they anticipated, and now they have to reaudit
everything to ensure exception-safety, because the code was never
written with that in mind...
Exceptions are an all or nothing thing. You can't just make them
optional or be exception-agnostic.
In all cases, all C++ code should be exception safe, unless you choose
to restrict yourself to a dialect of C++ where exceptions do not exist,
that is say C.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk