
On Wed, Mar 23, 2011 at 4:57 PM, Robert Kawulak <robert.kawulak@gmail.com> wrote:
In the context of guidelines, preferring BOOST_THROW_EXCEPTION over plain throw is NOT about supporting BOOST_NO_EXEPTIONS platforms. Of course, if try/catch/throw are not used in the code, you get this ability for free as a bonus. That's nice too, but that's not the main point.
The points are already explained by Emil and me: - automatic attachment of throw site information (file/line/function), letting you guess what went wrong at a glimpse without even needing to attach debugger in some cases, - enabling mechanism for attaching extra information via boost::error_info and building verbose error descriptions using this information by boost::diagnostic_information, - enabling transfer of exceptions between threads, - providing global customisation point of exception-throwing behaviour, just like BOOST_ASSERT does for the assert macro.
In my mind it's exactly the other way around: the main point of BOOST_THROW_EXCEPTION is to support BOOST_NO_EXCEPTIONS builds, the other stuff is just a free bonus. I say this because BOOST_THROW_EXCEPTION simply captures __FILE__ and __LINE__, otherwise it just calls boost::throw_exception(). Historically, the *only* point of boost::throw_exception() was to support BOOST_NO_EXCEPTION builds. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode