no_exceptions_support.hpp
Go to the documentation of this file.
00001 #ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
00002 #define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
00003 
00004 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
00005 #  pragma once
00006 #endif
00007 
00008 //----------------------------------------------------------------------
00009 // (C) Copyright 2004 Pavel Vozenilek.
00010 // Use, modification and distribution is subject to the Boost Software
00011 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt
00012 // or copy at http://www.boost.org/LICENSE_1_0.txt)
00013 //
00014 //
00015 // This file contains helper macros used when exception support may be
00016 // disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
00017 //
00018 // Before picking up these macros you may consider using RAII techniques
00019 // to deal with exceptions - their syntax can be always the same with 
00020 // or without exception support enabled.
00021 //
00022 
00023 /* Example of use:
00024 
00025 void foo() {
00026   BOOST_TRY {
00027     ...
00028   } BOOST_CATCH(const std::bad_alloc&) {
00029       ...
00030       BOOST_RETHROW
00031   } BOOST_CATCH(const std::exception& e) {
00032       ...
00033   }
00034   BOOST_CATCH_END
00035 }
00036 
00037 With exception support enabled it will expand into:
00038 
00039 void foo() {
00040   { try {
00041     ...
00042   } catch (const std::bad_alloc&) {
00043       ...
00044       throw;
00045   } catch (const std::exception& e) {
00046       ...
00047   }
00048   }
00049 }
00050 
00051 With exception support disabled it will expand into:
00052 
00053 void foo() {
00054   { if(true) {
00055     ...
00056   } else if (false) {
00057       ...
00058   } else if (false)  {
00059       ...
00060   }
00061   }
00062 }
00063 */
00064 //----------------------------------------------------------------------
00065 
00066 #include <boost/config.hpp>
00067 #include <boost/detail/workaround.hpp>
00068 
00069 #if !(defined BOOST_NO_EXCEPTIONS)
00070 #    define BOOST_TRY { try
00071 #    define BOOST_CATCH(x) catch(x)
00072 #    define BOOST_RETHROW throw;
00073 #    define BOOST_CATCH_END }
00074 #else
00075 #    if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
00076 #        define BOOST_TRY { if ("")
00077 #        define BOOST_CATCH(x) else if (!"")
00078 #    else
00079 #        define BOOST_TRY { if (true)
00080 #        define BOOST_CATCH(x) else if (false)
00081 #    endif
00082 #    define BOOST_RETHROW
00083 #    define BOOST_CATCH_END }
00084 #endif
00085 
00086 
00087 #endif 


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29