Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-03-05 14:31:11

After discussion on this topic (very helpful), I suggest
to place following code into <boost/throw_exception.hpp>:

#include <boost/detail/workaround.hpp>

#if !(defined BOOST_NO_EXCEPTIONS)
# define BOOST_TRY { try
# define BOOST_CATCH(x) catch(x)
# define BOOST_RETHROW throw
# define BOOST_CATCH_END }
# define BOOST_TRY { if ("")
# define BOOST_CATCH(x) else if (!"")
# else
# define BOOST_TRY if (true)
# define BOOST_CATCH else if (false)
# endif
# define BOOST_CATCH_END }

These macros are NOT intended as recomended practice for users.
They exist only to avoid having similar macros in Circular Buffer,
Indexed Set and Serialization each.

These macros:
- do not produce warnings (VC/Intel/BCB) with or w/o exceptions enabled,
- work within if/else statement,
- are hopefully ugly enough so users will prefere RAII in application code,
- do not conflict within Boost (1.31).

As they are written for "internal purpose" only they do not need
to be oficially documented, IMO.


Boost list run by bdawes at, gregod at, cpdaniel at, john at