Boost logo

Boost :

Subject: [boost] [exception] uncaught_exception_count, scope(failure), scope(success)
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2013-02-05 14:11:44

Hello All,

There is implementation of uncaught_exception_count -

uncaught_exception_count is a function similar to
std::uncaught_exception from standard library, but instead of boolean
result it returns unsigned int showing current count of uncaught exceptions.

uncaught_exception_count allow us to implement scope(failure) and
scope(success) features from D language in C++. ( previous discussion is

Implementation of uncaught_exception_count is tested on {Clang 3.2, GCC
3.4.6, GCC 4.1.2, GCC 4.4.6, GCC 4.4.7, MSVC2005SP1, MSVC2008SP1,
MSVC2010SP1, MSVC2012} x {x32, x64}.

There are also live stress tests - detection of 500 simultaneous
uncaught exceptions:
GCC 4.6.3:
GCC 4.7.2:
Clang 3.2:

I think that uncaught_exception_count (and
uncaught_exception_count_latch primitive) can be added into
Boost.Exception library, at least into "detail" section.

After that scope(failure) and scope(success) features can be implemented
in Boost.ScopeExit library.
Note, approximately 14 of 16 Boost.ScopeExit examples in manual are in
fact emulations of scope(failure)/scope(success). So, looks like in
first place Boost.ScopeExit was introduced to simplify emulation of
scope(failure) and scope(success) features.

What do you think?

Thank you.

Best Regards,
Evgeny Panasyuk

Boost list run by bdawes at, gregod at, cpdaniel at, john at