
Vicente BOTET <vicente.botet <at> wanadoo.fr> writes:
On Tue, Mar 22, 2011 at 12:16 PM, Krzysztof Czainski <1czajnik <at> gmail.com> wrote:
What about boost/detail/no_exceptions_support.hpp? [...]
I'm wonderyn if the following wouldn't be more natural
void foo() { BOOST_TRY { ... } BOOST_CATCH(const std::bad_alloc&) { ... BOOST_RETHROW } BOOST_CATCH(const std::exception& e) { ... } BOOST_CATCH_ALL { ... } }
If you refer to why BOOST_CATCH_END is needed in the original formulation, consider the following: if(so) BOOST_TRY{ foo(); } BOOST_CATCH(const std::exception& e){ bar(); BOOST_RETHROW } else baz(); This, using your variation, expands to if(so) if (true){ foo(); } else if (false){ bar(); } else baz(); which is equivalent to (note the braces) if(so){ if (true){ foo(); } else if (false){ bar(); } else{ baz(); } } which is clearly not the intention. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo