Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-02-29 11:28:07


> 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).

I doubt you'll find a satisfactory one, there are pragmas that can disable
those warnings, but that introduces even more code than the traditional:

#ifndef BOOST_NO_EXCEPTIONS
catch(x)
{
}
#endif

I suggest we review these when the first of these lib's comes up for review,
anyone else want to comment?

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk