$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50705 - in trunk: boost/system libs/system/src
From: bdawes_at_[hidden]
Date: 2009-01-21 13:01:14
Author: bemandawes
Date: 2009-01-21 13:01:14 EST (Wed, 21 Jan 2009)
New Revision: 50705
URL: http://svn.boost.org/trac/boost/changeset/50705
Log:
System: provide optional throws function rather than throws object
Text files modified: 
   trunk/boost/system/error_code.hpp    |    10 ++++++++++                              
   trunk/libs/system/src/error_code.cpp |     2 ++                                      
   2 files changed, 12 insertions(+), 0 deletions(-)
Modified: trunk/boost/system/error_code.hpp
==============================================================================
--- trunk/boost/system/error_code.hpp	(original)
+++ trunk/boost/system/error_code.hpp	2009-01-21 13:01:14 EST (Wed, 21 Jan 2009)
@@ -384,7 +384,17 @@
     };
 
     //  predefined error_code object used as "throw on error" tag
+# ifndef BOOST_SYSTEM_THROWS_FUNCTION
     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  ------------------------------------------------//
 
Modified: trunk/libs/system/src/error_code.cpp
==============================================================================
--- trunk/libs/system/src/error_code.cpp	(original)
+++ trunk/libs/system/src/error_code.cpp	2009-01-21 13:01:14 EST (Wed, 21 Jan 2009)
@@ -411,11 +411,13 @@
   namespace system
   {
 
+# ifndef BOOST_SYSTEM_THROWS_FUNCTION
     BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
                                          //  note that it doesn't matter if this
                                          //  isn't initialized before use since
                                          //  the only use is to take its
                                          //  address for comparison purposes
+# endif
 
     BOOST_SYSTEM_DECL const error_category & get_system_category()
     {