Boost logo

Boost :

Subject: Re: [boost] [inspect] exceptions (FW: [Boost-users] no exceptions)
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-03-23 12:55:46


On Wed, Mar 23, 2011 at 12:07 AM, Emil Dotchevski
<emildotchevski_at_[hidden]> wrote:
> On Tue, Mar 22, 2011 at 11:37 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>> At Tue, 22 Mar 2011 11:38:59 +0300,
>> Vladimir Prus wrote:
>>>
>>> Emil Dotchevski wrote:
>>>
>>> > On Mon, Mar 21, 2011 at 6:39 PM, Robert Kawulak
>>> > <robert.kawulak_at_[hidden]> wrote:
>>> >> >From Boost Users ML:
>>> >>
>>> >>> From: Hochhaus, Andrew
>>> >>> I would like to use boost with BOOST_NO_EXCEPTIONS [1] and the g++
>>> >>> -fno-exceptions flag. However, it appears that some spots in boost
>>> >>> library code:
>>> >>>
>>> >>> a) throw exceptions with the "raw" throw keyword [instead of
>>> >>> BOOST_THROW_EXCEPTION or boost::throw_exception]
>>> >>> b) use try ... catch blocks without "#ifnef BOOST_NO_EXCEPTIONS" guards
>>> >>
>>> >> Wouldn't it be a good idea to add checks for these to the inspect tool? Also, non-empty
>>> >> exception specifications are discouraged by Boost guidelines - should appropriate checks be
>>> >> added too?
>>> >
>>> > +1
>>>
>>> I don't think that Boost libraries are required to support
>>> non-conforming compilers or operation modes of compilers, therefore
>>> adding inspect check for a workaround for such non-comforming
>>> behaviour would be wrong, I think.
>>
>> Well... I was going to write this:
>>
>>   I think we ought to establish something weaker than requirements
>>   but still official, like "portability best practices" or something,
>>   that would include making the adjustments needed to run in
>>   exception-free environments.
>>
>> but the more I think about it, the less clear I am on what that means.
>> Would we be asking people to try to recover from out-of-memory and
>> other exceptional conditions via some other mechanism when exceptions
>> are disabled?  That seems impractical to me.  We could barely even use
>> the standard library under those circumstances.  What do people who
>> turn off exceptions expect from their libraries?
>
> What they expect is beyond our control, but this is what we require:
> http://www.boost.org/doc/libs/release/libs/exception/doc/throw_exception.html.

That does not look like a requirement on Boost library authors to me,
so it makes me wonder about its relevance.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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