|
Boost : |
From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-02-27 16:48:49
Disabling try/catch through preprocessor when
compiling without exception support was suggested
e.g by Robert Ramey in:
http://aspn.activestate.com/ASPN/Mail/Message/boost/1799735
Right now there are 3 libraries near review, each using their
own set of similar macros:
- circular_buffer
- indexed_set
- serialization
The reasons to use macros instead of RAII is convenience
and performance.
Some compilers (BCB) do not allow try/catch with
exceptions disabled so some solution is needed.
It would be better to have and use standardized macros
in Boost.
Example: macros used in indexed_set:
#if !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_INDEXED_SET_TRY try
# define BOOST_INDEXED_SET_CATCH(x) catch(x)
# define BOOST_INDEXED_SET_RETHROW throw
#else
# define BOOST_INDEXED_SET_TRY
# define BOOST_INDEXED_SET_CATCH(x) if(0)
# define BOOST_INDEXED_SET_RETHROW
#endif
Compiles w/o warnings on VC6+, BCB gives unreachable
code warning (but I'll try to find workaround).
/Pavel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk