boost::throw_exception(...) behaviour and use case
I was wondering what behaviour or idiom does boost::throw_exception enable. I must be dense but the documentation here (http://www.boost.org/doc/libs/1_55_0/libs/exception/doc/throw_exception.html) does not immediately ring a bell. Is it meant to somehow help write code that runs both in environments where exceptions are enabled and where they are not? Since the structure of code that does not use exception handling tends to be quite different from that which does, I was wondering what's a correct idiomatic use of Boost. Of course I am aware that my basic assumption might be incorrect. Thanks, Arindam
On Thu, May 22, 2014 at 8:24 AM, Arindam Mukherjee
I was wondering what behaviour or idiom does boost::throw_exception enable. I must be dense but the documentation here (http://www.boost.org/doc/libs/1_55_0/libs/exception/doc/throw_exception.html) does not immediately ring a bell. Is it meant to somehow help write code that runs both in environments where exceptions are enabled and where they are not?
1) It enables library developers to write code that can run in both environments. 2) It enables users of libraries that throw by boost::throw_exception to write programs targeting exception-free environments. 3) It enables the rest of the Boost Exception functionality: exception_ptr and transporting arbitrary data in exception objects. Note that in 2) the program itself is specifically designed to target exception-free environments, the developer being aware of the exact conditions under which libraries call boost::throw_exception. -- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
participants (2)
-
Arindam Mukherjee
-
Emil Dotchevski