safe_numerics/doc/boostbook/overflow.xml

59 lines
1.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<section id="safe_numerics.rationale.overflow">
<title id="safe_numerics.functions.overflow">overflow</title>
<section>
<title>Synopsis</title>
<para>This function is invoked by the library whenever it is not possible
to produce a result for an arithmetic operation.</para>
<para><programlisting>void overflow(char const * const msg);</programlisting></para>
</section>
<section>
<title>Description</title>
<para>If environment supports C++ exceptions, this function throws the
exception .</para>
<para>If the environment does not support C++ exceptions, the user should
implement this function and expect it to be called when
appropriate.</para>
<para><filename>boost/config.hpp </filename>defines BOOST_NO_EXCEPTIONS
when the environment doesn't support exceptions. It is by checking for the
definition of this macro that the system determines whether or not
exceptions are supported.</para>
</section>
<section>
<title>Header</title>
<para><ulink url="../include/safe_numerics/overflow"><code>#include
&lt;boost/safe_numerics/overflow.hpp&gt; </code></ulink></para>
</section>
<section>
<title>Example of use</title>
<programlisting>#include &lt;cstdio&gt;
void overflow(char const * const msg){
std::fputs("safe_numerics overflow error:, std::stderr);
std::fputs(msg, std::stderr);
std::fputc('\n', std::stderr);
}</programlisting>
</section>
<section>
<title>See Also</title>
<para>See <link
linkend="safe_numerics.rationale.overflow">rationale</link> for more
information on this function</para>
</section>
</section>