[C++-sig] throw_error_already_set and compiler warnings

Johan Råde johan.rade at gmail.com
Wed Feb 29 09:30:07 CET 2012


The declaration

   BOOST_PYTHON_DECL void throw_error_already_set();

should maybe be changed to

   BOOST_PYTHON_DECL BOOST_ATTRIBUTE_NORETURN void 
throw_error_already_set();

This will help eliminate warnings on some compilers,
and will save people the trouble of writing code like

   int f()
   {
     ...
     boost::python::throw_error_already_set();
     return 0;	// unreachable but needed to silence compiler warning
   }

BOOST_ATTRIBUTE_NORETURN is defined in 
boost/exception/detail/attribute_noreturn.hpp.



More information about the Cplusplus-sig mailing list