overflow.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. <section>
  7. <title>Synopsis</title>
  8. <para>This function is invoked by the library whenever it is not possible
  9. to produce a result for an arithmetic operation.</para>
  10. <para><programlisting>void overflow(char const * const msg);</programlisting></para>
  11. </section>
  12. <section>
  13. <title>Description</title>
  14. <para>If environment supports C++ exceptions, this function throws the
  15. exception .</para>
  16. <para>If the environment does not support C++ exceptions, the user should
  17. implement this function and expect it to be called when
  18. appropriate.</para>
  19. <para><filename>boost/config.hpp </filename>defines BOOST_NO_EXCEPTIONS
  20. when the environment doesn't support exceptions. It is by checking for the
  21. definition of this macro that the system determines whether or not
  22. exceptions are supported.</para>
  23. </section>
  24. <section>
  25. <title>Header</title>
  26. <para><ulink url="../include/safe_numerics/overflow"><code>#include
  27. &lt;boost/safe_numerics/overflow.hpp&gt; </code></ulink></para>
  28. </section>
  29. <section>
  30. <title>Example of use</title>
  31. <programlisting>#include &lt;cstdio&gt;
  32. void overflow(char const * const msg){
  33. std::fputs("safe_numerics overflow error:, std::stderr);
  34. std::fputs(msg, std::stderr);
  35. std::fputc('\n', std::stderr);
  36. }</programlisting>
  37. </section>
  38. <section>
  39. <title>See Also</title>
  40. <para>See <link
  41. linkend="safe_numerics.rationale.overflow">rationale</link> for more
  42. information on this function</para>
  43. </section>
  44. </section>