mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-02-12 12:22:16 +00:00
147 lines
6.7 KiB
HTML
147 lines
6.7 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>ExceptionPolicy<EP></title>
|
|
<link rel="stylesheet" href="boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
|
<link rel="home" href="index.html" title="Safe Numerics">
|
|
<link rel="up" href="concepts.html" title="Type Requirements">
|
|
<link rel="prev" href="promotion_policy.html" title="PromotionPolicy<PP>">
|
|
<link rel="next" href="types.html" title="Types">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img href="index.html" height="164px" src="pre-boost.jpg" alt="Library Documentation Index"></td>
|
|
<td><h2>Safe Numerics</h2></td>
|
|
</tr></table>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="promotion_policy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="types.html"><img src="images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="safe_numerics.exception_policy"></a>ExceptionPolicy<EP></h3></div></div></div>
|
|
<div class="toc"><dl>
|
|
<dt><span class="section"><a href="exception_policy.html#idm110745196240">Description</a></span></dt>
|
|
<dt><span class="section"><a href="exception_policy.html#idm110745194816">Notation</a></span></dt>
|
|
<dt><span class="section"><a href="exception_policy.html#idm110745188288">Valid Expressions</a></span></dt>
|
|
<dt><span class="section"><a href="exception_policy.html#idm110745178336">Header</a></span></dt>
|
|
<dt><span class="section"><a href="exception_policy.html#idm110745176304">Models</a></span></dt>
|
|
</dl></div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm110745196240"></a>Description</h4></div></div></div>
|
|
<p>The exception policy specifies what is to occur when a safe
|
|
operation cannot return a valid arithmetic result. A type is an
|
|
ExceptionPolicy if it has functions for handling exceptional events that
|
|
occur in the course of safe numeric operations.</p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm110745194816"></a>Notation</h4></div></div></div>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup>
|
|
<col align="left">
|
|
<col align="left">
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<td align="left"><code class="computeroutput">EP</code></td>
|
|
<td align="left">A type that full fills the requirements of an
|
|
ExceptionPollicy</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left">message</td>
|
|
<td align="left">A const char * which refers to a text message about the
|
|
cause of an exception</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm110745188288"></a>Valid Expressions</h4></div></div></div>
|
|
<p>Any operations which result in integers which cannot be represented
|
|
as some Numeric type will throw an exception.</p>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup>
|
|
<col align="left">
|
|
<col align="left">
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th align="left">Expression</th>
|
|
<th align="left">Return Value</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td align="left"><code class="computeroutput">EP::overflow_error(const char *
|
|
message)</code></td>
|
|
<td align="left">void</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left"><code class="computeroutput">EP::underflow_error(const char *
|
|
message)</code></td>
|
|
<td align="left">void</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left"><code class="computeroutput">EP::range_error(const char *
|
|
message)</code></td>
|
|
<td align="left">void</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm110745178336"></a>Header</h4></div></div></div>
|
|
<p><a href="../../include/concept/exception_policy.hpp" target="_top"><code class="computeroutput">#include
|
|
<safe_numerics/include/concepts/exception_policy.hpp>
|
|
</code></a></p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm110745176304"></a>Models</h4></div></div></div>
|
|
<p>The library header <a href="../../include/exception_policies.hpp" target="_top"><code class="computeroutput"><safe_numerics/include/exception_policies.hpp>
|
|
</code></a>contains a number of pre-made exception policies:</p>
|
|
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
|
<li class="listitem">
|
|
<p><a name="safe_numerics.exception_policy.models.thow_exception"></a><code class="computeroutput">boost::numeric::throw_exception</code></p>
|
|
<p>If an exceptional condition is detected at runtime throw the
|
|
exception. Safe types use this exception policy as the default if no
|
|
other one is specified.</p>
|
|
</li>
|
|
<li class="listitem">
|
|
<p><a name="safe_numerics.exception_policy.models.ignore_exception"></a><code class="computeroutput">boost::numeric::ignore_exception</code></p>
|
|
<p>Emulate the normal C/C++ behavior of permitting overflows,
|
|
underflows etc.</p>
|
|
</li>
|
|
<li class="listitem">
|
|
<p><a name="safe_numerics.exception_policy.models.no_exception_support"></a><code class="computeroutput">template<void (*F)(const char *), void (*G)(const char
|
|
*), void (*H)(const char *)></code></p>
|
|
<p><code class="computeroutput">boost::numeric::no_exception_support</code></p>
|
|
<p>If you want to specify specific behavior for particular
|
|
exception types, use this policy. The most likely situation is where
|
|
you don't have exception support and you want to trap "exceptions" by
|
|
calling your own special functions.</p>
|
|
</li>
|
|
<li class="listitem">
|
|
<p><a name="safe_numerics.exception_policy.models.trap_exception"></a><code class="computeroutput">boost::numeric::trap_exception</code></p>
|
|
<p>Use this policy to trap at compile time any operation which
|
|
would otherwise trap at runtime. Hence expressions such as i/j will
|
|
trap at compile time unless j can be guaranteed to not be zero.</p>
|
|
</li>
|
|
</ul></div>
|
|
</div>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2012 Robert Ramey<p><a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost
|
|
Software License</a></p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="promotion_policy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="types.html"><img src="images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|