Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2007-09-19 15:28:56


Author: bemandawes
Date: 2007-09-19 15:28:56 EDT (Wed, 19 Sep 2007)
New Revision: 39394
URL: http://svn.boost.org/trac/boost/changeset/39394

Log:
Add get_posix_category, get_system_category, to solve order-of-initialization issues
Text files modified:
   trunk/boost/system/error_code.hpp | 11 +++++++----
   trunk/libs/system/src/error_code.cpp | 23 ++++++++++-------------
   2 files changed, 17 insertions(+), 17 deletions(-)

Modified: trunk/boost/system/error_code.hpp
==============================================================================
--- trunk/boost/system/error_code.hpp (original)
+++ trunk/boost/system/error_code.hpp 2007-09-19 15:28:56 EDT (Wed, 19 Sep 2007)
@@ -162,12 +162,15 @@
 
     // predefined error categories -----------------------------------------//
 
- BOOST_SYSTEM_DECL extern const error_category & posix_category;
- BOOST_SYSTEM_DECL extern const error_category & system_category;
+ BOOST_SYSTEM_DECL const error_category & get_system_category();
+ BOOST_SYSTEM_DECL const error_category & get_posix_category();
 
+ static const error_category & system_category = get_system_category();
+ static const error_category & posix_category = get_posix_category();
+
     // deprecated synonyms
- BOOST_SYSTEM_DECL extern const error_category & errno_ecat; // posix_category
- BOOST_SYSTEM_DECL extern const error_category & native_ecat; // system_category
+ static const error_category & errno_ecat = get_posix_category();
+ static const error_category & native_ecat = get_system_category();
 
     // class error_condition -----------------------------------------------//
 

Modified: trunk/libs/system/src/error_code.cpp
==============================================================================
--- trunk/libs/system/src/error_code.cpp (original)
+++ trunk/libs/system/src/error_code.cpp 2007-09-19 15:28:56 EDT (Wed, 19 Sep 2007)
@@ -214,8 +214,8 @@
     error_condition default_error_condition( int ev ) const;
   };
 
- const posix_error_category posix_category_const;
- const system_error_category system_category_const;
+ const posix_error_category posix_category_const;
+ const system_error_category system_category_const;
 
   // posix_error_category implementation ---------------------------------//
 
@@ -376,18 +376,15 @@
   namespace system
   {
 
- BOOST_SYSTEM_DECL const error_category & posix_category
- = posix_category_const;
-
- BOOST_SYSTEM_DECL const error_category & system_category
- = system_category_const;
-
- // deprecated synonyms
- BOOST_SYSTEM_DECL const error_category & errno_ecat
- = posix_category_const;
+ BOOST_SYSTEM_DECL const error_category & get_system_category()
+ {
+ return system_category_const;
+ }
 
- BOOST_SYSTEM_DECL const error_category & native_ecat
- = system_category_const;
+ BOOST_SYSTEM_DECL const error_category & get_posix_category()
+ {
+ return posix_category_const;
+ }
 
   } // namespace system
 } // namespace boost


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk