• 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.exception_policies.no_exception_support">
5  <title>no_exception_support&lt;NoError, UnInitalized, Overflow, Underflow,
6  Range, Domain&gt;</title>
7
8  <section>
9    <title>Description</title>
10
11    <para>This exception policy can be used in an environment where one cannot
12    or does not want to use exceptions.</para>
13
14    <para>Parameters are pointers to static functions which are invoked for
15    each kind of error encountered in the library. The function signature of
16    these functions are <code>void function(const char * message)</code> where
17    <code>message</code> is the address of a literal string with information
18    regarding the error.</para>
19  </section>
20
21  <section>
22    <title>Template Parameters</title>
23
24    <para>Function objects to be invoked are specified for each error
25    condition via template parameters.</para>
26
27    <informaltable>
28      <tgroup cols="4">
29        <colspec align="left"/>
30
31        <colspec align="left" colwidth="3*"/>
32
33        <colspec align="left" colwidth="6*"/>
34
35        <thead>
36          <row>
37            <entry align="left">Parameter</entry>
38
39            <entry align="left">Type Requirements</entry>
40
41            <entry>Description</entry>
42          </row>
43        </thead>
44
45        <tbody>
46          <row>
47            <entry><code>NoError</code></entry>
48
49            <entry><code>void (*NoError)(const char *)</code></entry>
50
51            <entry><para>Function to call on when an operation is invoked
52            which COULD throw but does not.</para></entry>
53          </row>
54
55          <row>
56            <entry><code>UnInitalized</code></entry>
57
58            <entry><code>void (*UnInitalizized)(const char *)</code></entry>
59
60            <entry><para>Function to call on when value is
61            uninitialized</para></entry>
62          </row>
63
64          <row>
65            <entry><code>Overflow</code></entry>
66
67            <entry><code>void (*Overflow)(const char *)</code></entry>
68
69            <entry><para>Function to call on overflow error</para></entry>
70          </row>
71
72          <row>
73            <entry><code>Overflow</code></entry>
74
75            <entry><code>void (*Overflow)(const char *)</code></entry>
76
77            <entry><para>Function to call on overflow error</para></entry>
78          </row>
79
80          <row>
81            <entry><code>Underflow</code></entry>
82
83            <entry><code>void (*Underflow)(const char *)</code></entry>
84
85            <entry><para>Function to call on underflow error</para></entry>
86          </row>
87
88          <row>
89            <entry><code>Range</code></entry>
90
91            <entry><code>void (*Range)(const char *)</code></entry>
92
93            <entry><para>Function to call on range error</para></entry>
94          </row>
95
96          <row>
97            <entry><code>Domain</code></entry>
98
99            <entry><code>void (*Domain)(const char *)</code></entry>
100
101            <entry>Function to call on domain error</entry>
102          </row>
103        </tbody>
104      </tgroup>
105    </informaltable>
106  </section>
107
108  <section>
109    <title>Model of</title>
110
111    <para><link
112    linkend="safe_numerics.promotion_policy">ExceptionPolicy</link></para>
113  </section>
114
115  <section>
116    <title>Header</title>
117
118    <para><code><ulink url="../../include/exception_policy.hpp"><code>#include
119    &lt;boost/safe_numerics/exception_policy.hpp&gt;
120    </code></ulink></code></para>
121  </section>
122
123  <section>
124    <title>Example of use</title>
125
126    <para>[A code fragment involving the type.]</para>
127
128    <programlisting>void no_error(const char * msg);
129void uninitialize(const char * msg);
130void overflow(const char * msg);
131void underflow(const char * msg);
132void range_error(const char * msg);
133void domain_error(const char * msg);
134
135using ep = ignore_exception&lt;
136    no_error,
137    uninitialized,
138    overflow,
139    underflow,
140    range_error,
141    domain_error
142&gt;;
143
144safe&lt;int, native, ep&gt; st(4);</programlisting>
145  </section>
146</section>
147