123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?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.exception_policies.no_exception_support">
- <title>no_exception_support<NoError, UnInitalized, Overflow, Underflow,
- Range, Domain></title>
- <section>
- <title>Description</title>
- <para>This exception policy can be used in an environment where one cannot
- or does not want to use exceptions.</para>
- <para>Parameters are pointers to static functions which are invoked for
- each kind of error encountered in the library. The function signature of
- these functions are <code>void function(const char * message)</code> where
- <code>message</code> is the address of a literal string with information
- regarding the error.</para>
- </section>
- <section>
- <title>Template Parameters</title>
- <para>Function objects to be invoked are specified for each error
- condition via template parameters.</para>
- <informaltable>
- <tgroup cols="4">
- <colspec align="left"/>
- <colspec align="left" colwidth="3*"/>
- <colspec align="left" colwidth="6*"/>
- <thead>
- <row>
- <entry align="left">Parameter</entry>
- <entry align="left">Type Requirements</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><code>NoError</code></entry>
- <entry><code>void (*NoError)(const char *)</code></entry>
- <entry><para>Function to call on when an operation is invoked
- which COULD throw but does not.</para></entry>
- </row>
- <row>
- <entry><code>UnInitalized</code></entry>
- <entry><code>void (*UnInitalizized)(const char *)</code></entry>
- <entry><para>Function to call on when value is
- uninitialized</para></entry>
- </row>
- <row>
- <entry><code>Overflow</code></entry>
- <entry><code>void (*Overflow)(const char *)</code></entry>
- <entry><para>Function to call on overflow error</para></entry>
- </row>
- <row>
- <entry><code>Overflow</code></entry>
- <entry><code>void (*Overflow)(const char *)</code></entry>
- <entry><para>Function to call on overflow error</para></entry>
- </row>
- <row>
- <entry><code>Underflow</code></entry>
- <entry><code>void (*Underflow)(const char *)</code></entry>
- <entry><para>Function to call on underflow error</para></entry>
- </row>
- <row>
- <entry><code>Range</code></entry>
- <entry><code>void (*Range)(const char *)</code></entry>
- <entry><para>Function to call on range error</para></entry>
- </row>
- <row>
- <entry><code>Domain</code></entry>
- <entry><code>void (*Domain)(const char *)</code></entry>
- <entry>Function to call on domain error</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- <section>
- <title>Model of</title>
- <para><link
- linkend="safe_numerics.promotion_policy">ExceptionPolicy</link></para>
- </section>
- <section>
- <title>Header</title>
- <para><code><ulink url="../../include/exception_policy.hpp"><code>#include
- <boost/safe_numerics/exception_policy.hpp>
- </code></ulink></code></para>
- </section>
- <section>
- <title>Example of use</title>
- <para>[A code fragment involving the type.]</para>
- <programlisting>void no_error(const char * msg);
- void uninitialize(const char * msg);
- void overflow(const char * msg);
- void underflow(const char * msg);
- void range_error(const char * msg);
- void domain_error(const char * msg);
- using ep = ignore_exception<
- no_error,
- uninitialized,
- overflow,
- underflow,
- range_error,
- domain_error
- >;
- safe<int, native, ep> st(4);</programlisting>
- </section>
- </section>
|