boostorg / boostorg/rational

BOOST_EXCEPTION_DISABLE does not work in rational

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
24
Forks
45
PR merge metrics
No merged PRs in 30d

Description

`BOOST_EXCEPTION_DISABLE` have no effect with rational lib. Due to:

rational.hpp
```cpp
// Input and output
template
std::istream& operator>> (std::istream& is, rational& r)
{
using std::ios;

IntType n = IntType(0), d = IntType(1);
char c = 0;
detail::resetter sentry(is);

if ( is >> n )
{
if ( is.get(c) )
{
if ( c == '/' )
{
if ( is >> std::noskipws >> d )
try {
r.assign( n, d );
} catch ( bad_rational & ) { // normalization fail
try { is.setstate(ios::failbit); }
catch ( ... ) {} // don't throw ios_base::failure...
if ( is.exceptions() & ios::failbit )
throw; // ...but the original exception instead
// ELSE: suppress the exception, use just error flags
}
}
else
is.setstate( ios::failbit );
}
}

return is;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.