Files
safe_numerics/doc/html/rationale.html
2013-11-04 11:44:56 -08:00

104 lines
4.4 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Rationale</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Safe Numerics">
<link rel="up" href="index.html" title="Safe Numerics">
<link rel="prev" href="rationale/overflow.html" title="overflow">
<link rel="next" href="change_log.html" title="Change Log">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="pre-boost" width="30%" height="30%" src="pre-boost.jpg"></td>
<td align="center"><a href="../../index.html">Home</a></td>
<td align="center"><a href="http://www.boost.org/doc/libs">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale/overflow.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="change_log.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="safe_numerics.rationale"></a>Rationale</h2></div></div></div>
<div class="qandaset">
<a name="id754861"></a><dl>
<dt>1. <a href="rationale.html#id754866">Why does a binary operation on two
safe&lt;int&gt; values not necessarily return another
safe type ?</a>
</dt>
<dt>2. <a href="rationale.html#id754917">Why is there no policy driven design for handling
overflows</a>
</dt>
<dt>3. <a href="rationale.html#id754946">Why is Boost.Convert not used.</a>
</dt>
</dl>
<table border="0" width="100%" summary="Q and A Set">
<col align="left" width="1%">
<col>
<tbody>
<tr class="question">
<td align="left" valign="top">
<a name="id754866"></a><a name="id754868"></a><p><b>1.</b></p>
</td>
<td align="left" valign="top"><p>Why does a binary operation on two
<code class="computeroutput">safe&lt;int&gt;</code> values not necessarily return another
<code class="computeroutput">safe</code> type ?</p></td>
</tr>
<tr class="answer">
<td align="left" valign="top"></td>
<td align="left" valign="top">
<p>There are a number of</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>it was hard to implement.</p></li>
<li class="listitem"><p>it doesn't really seem necessary. We always do SOMETHING
with result of the operation. This will result in an assignment
or a conversion to some other type where the result will be
validated.</p></li>
</ul></div>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="id754917"></a><a name="id754920"></a><p><b>2.</b></p>
</td>
<td align="left" valign="top">
<p>Why is there no policy driven design for handling
overflows</p>
<p>The question was - to which type does one apply it to?
Consider the following example:</p>
<pre class="programlisting">safe&lt;int, overflow_policy_1&gt; t1 = 2;
safe&lt;int, overflow_policy_2&gt; t2 = 4;
unsigned int x = t1 - t2; // which policy should be invoked?</pre>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="id754946"></a><a name="id754948"></a><p><b>3.</b></p>
</td>
<td align="left" valign="top">
<p>Why is Boost.Convert not used.</p>
<p>I couldn't figure out how to use it from the
documentation.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2012 Robert Ramey<p><a href="???" target="_top">Subject to Boost Software License</a></p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale/overflow.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="change_log.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>