• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN"
3"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
4<section id="safe_numerics.rationale.overflow">
5  <title id="safe_numerics.functions.overflow">overflow</title>
6
7  <section>
8    <title>Synopsis</title>
9
10    <para>This function is invoked by the library whenever it is not possible
11    to produce a result for an arithmetic operation.</para>
12
13    <para><programlisting>void overflow(char const * const msg);</programlisting></para>
14  </section>
15
16  <section>
17    <title>Description</title>
18
19    <para>If environment supports C++ exceptions, this function throws the
20    exception .</para>
21
22    <para>If the environment does not support C++ exceptions, the user should
23    implement this function and expect it to be called when
24    appropriate.</para>
25
26    <para><filename>boost/config.hpp </filename>defines BOOST_NO_EXCEPTIONS
27    when the environment doesn't support exceptions. It is by checking for the
28    definition of this macro that the system determines whether or not
29    exceptions are supported.</para>
30  </section>
31
32  <section>
33    <title>Header</title>
34
35    <para><ulink url="../include/safe_numerics/overflow"><code>#include
36    &lt;boost/safe_numerics/overflow.hpp&gt; </code></ulink></para>
37  </section>
38
39  <section>
40    <title>Example of use</title>
41
42    <programlisting>#include &lt;cstdio&gt;
43
44void overflow(char const * const msg){
45    std::fputs("safe_numerics overflow error:, std::stderr);
46    std::fputs(msg, std::stderr);
47    std::fputc('\n', std::stderr);
48}</programlisting>
49  </section>
50
51  <section>
52    <title>See Also</title>
53
54    <para>See <link
55    linkend="safe_numerics.rationale.overflow">rationale</link> for more
56    information on this function</para>
57  </section>
58</section>
59