mirror of
https://github.com/boostorg/system.git
synced 2025-07-30 12:37:13 +02:00
System: provide optional throws function rather than throws object
[SVN r50705]
This commit is contained in:
@ -384,7 +384,17 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
// predefined error_code object used as "throw on error" tag
|
// predefined error_code object used as "throw on error" tag
|
||||||
|
# ifndef BOOST_SYSTEM_THROWS_FUNCTION
|
||||||
BOOST_SYSTEM_DECL extern error_code throws;
|
BOOST_SYSTEM_DECL extern error_code throws;
|
||||||
|
# else
|
||||||
|
namespace detail { inline error_code * throws() { return 0; } }
|
||||||
|
// prevent misuse by poisoning the reference in a way that doesn't
|
||||||
|
// produce warnings or errors from popular compilers, and is also
|
||||||
|
// very efficient (as determined by inspectiing generated code)
|
||||||
|
|
||||||
|
inline error_code & throws()
|
||||||
|
{ return *detail::throws(); }
|
||||||
|
# endif
|
||||||
|
|
||||||
// non-member functions ------------------------------------------------//
|
// non-member functions ------------------------------------------------//
|
||||||
|
|
||||||
|
@ -411,11 +411,13 @@ namespace boost
|
|||||||
namespace system
|
namespace system
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# ifndef BOOST_SYSTEM_THROWS_FUNCTION
|
||||||
BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
|
BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
|
||||||
// note that it doesn't matter if this
|
// note that it doesn't matter if this
|
||||||
// isn't initialized before use since
|
// isn't initialized before use since
|
||||||
// the only use is to take its
|
// the only use is to take its
|
||||||
// address for comparison purposes
|
// address for comparison purposes
|
||||||
|
# endif
|
||||||
|
|
||||||
BOOST_SYSTEM_DECL const error_category & get_system_category()
|
BOOST_SYSTEM_DECL const error_category & get_system_category()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user