Boost logo

Boost :

Subject: [boost] [numeric] Applying trivial bugfix
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2012-02-22 15:14:56


Hi,

There are a lot of feature requests to support compilation with
disabled exceptions #5731, #5076, #5393, #5800.

Fix is trivial and well known: replace throw x; with
BOOST_THROW_EXCEPTION(x); in a converter_policies.hpp file. But the
library maintainer does not like BOOST_THROW_EXCEPTION because of code
bloat.

Can I apply another trivial fix:

struct def_overflow_handler

{

  void operator() ( range_check_result r ) //
throw(negative_overflow,positive_overflow)

  {

#ifndef BOOST_NO_EXCEPTIONS

    if ( r == cNegOverflow )

      throw negative_overflow() ;

    else if ( r == cPosOverflow )

           throw positive_overflow() ;

#else

    if ( r == cNegOverflow )

      ::boost::throw_exception(negative_overflow()) ;

    else if ( r == cPosOverflow )

           ::boost::throw_exception(positive_overflow()) ;

#endif

  }

} ;

Adding this will fix all the tickets and allow some of the dependent
libraries to build with disabled exceptions.

Boost.Lexical_cast tests will cover Boost.Numeric usage cases with
disabled exceptions.

Best regards,

Antony Polukhin


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