$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50727 - in trunk: boost/system libs/system/src
From: bdawes_at_[hidden]
Date: 2009-01-22 09:47:51
Author: bemandawes
Date: 2009-01-22 09:47:50 EST (Thu, 22 Jan 2009)
New Revision: 50727
URL: http://svn.boost.org/trac/boost/changeset/50727
Log:
System: move throws function to namespace boost to allow peaceful coexistence with throws object.
Text files modified: 
   trunk/boost/system/error_code.hpp    |    30 +++++++++++++++++++++---------          
   trunk/libs/system/src/error_code.cpp |     2 +-                                      
   2 files changed, 22 insertions(+), 10 deletions(-)
Modified: trunk/boost/system/error_code.hpp
==============================================================================
--- trunk/boost/system/error_code.hpp	(original)
+++ trunk/boost/system/error_code.hpp	2009-01-22 09:47:50 EST (Thu, 22 Jan 2009)
@@ -384,18 +384,30 @@
     };
 
     //  predefined error_code object used as "throw on error" tag
-# ifndef BOOST_SYSTEM_THROWS_FUNCTION
+# ifndef BOOST_SYSTEM_NO_DEPRECATED
     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
 
+    //  Moving from a "throws" object to a "throws" function without breaking
+    //  existing code is a bit of a problem. The workaround is to place the
+    //  "throws" function in namespace boost rather than namespace boost::system.
+
+  }  // namespace system
+
+  namespace detail { inline system::error_code * throws() { return 0; } }
+    //  Misuse of the error_code object is turned into a noisy failure by
+    //  poisoning the reference. This particular implementation doesn't
+    //  produce warnings or errors from popular compilers, is very efficient
+    //  (as determined by inspecting generated code), and does not suffer
+    //  from order of initialization problems. In practice, it also seems
+    //  cause user function error handling implementation errors to be detected
+    //  very early in the development cycle.
+
+  inline system::error_code & throws()
+    { return *detail::throws(); }
+
+  namespace system
+  {
     //  non-member functions  ------------------------------------------------//
 
     inline bool operator!=( const error_code & lhs,
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-22 09:47:50 EST (Thu, 22 Jan 2009)
@@ -411,7 +411,7 @@
   namespace system
   {
 
-# ifndef BOOST_SYSTEM_THROWS_FUNCTION
+# ifndef BOOST_SYSTEM_NO_DEPRECATED
     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