|
Boost : |
Subject: Re: [boost] Policy proposal: All user-visible exceptions should be thrown through BOOST_THROW_EXCEPTION
From: Brian Wood (woodbrian77_at_[hidden])
Date: 2012-06-28 13:42:49
Emil Dotchevski:
>On Wed, Jun 27, 2012 at 7:46 AM, Brian Wood <woodbrian77_at_[hidden]> wrote:
>> Emil Dotchevski:
>>
>> >
>> > There are 3 aspects of boost::throw_exception:
>> >
>> > 1) it enables libraries to support BOOST_NO_EXCEPTIONS configurations,
>> > 2) it enables boost::error_info, and
>> > 3) it enables boost::exception_ptr.
>> >
>> > 1) and 2) have nothing to do with threads; 3) implements
>> > std::exception_ptr, which mostly benefits multi-thread programs (until
>> > compilers catch up with std::exception_ptr support.)
>> >
>> > The cost imposed by libraries that use boost::throw_exception to
programs
>> > that don't use boost::exception_ptr or boost::error_info is that
sizeof()
>> > the exception object grows a little.
>>
>> I'd appreciate a way at compile time to let Boost Exception know
>> I'm using it in a single threaded application and it wouldn't add stuff
>> to the exception object that isn't needed. Also MSDN says,
>> "Most applications do not have to transport exceptions between threads."
>>
>
> There are exception_ptr use cases for single threaded programs.
I'm not asking for this to be the default even for single threaded
programs. I'd like it to be something that a user could opt out
of if they want to. (This is all based on the possibilty that
Boost Exception could become required. If that doesn't happen,
this request wouldn't be very pressing from my perspective.)
I haven't found much on use cases in single threaded programs.
Do you have any links? I did find the following comment in some
code that uses exception_ptr.
"The reason here is that construction/destruction of an exception_ptr
are not "cheap""
Shalom,
Brian Wood
Ebenezer Enterprises
http://webEbenezer.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk