title: Converting Integer Types
body: <p>How does one convert from one integer type to another safely and with setting off alarm bells in compilers and static analysis tools?</p>
  <p>Different compilers will warn for something like:</p>
  <pre><code>int i = get_int();
  size_t s = i;
  </code></pre>
  <p>for loss of signedness or</p>
  <pre><code>size_t s = get_size();
  int i = s;
  </code></pre>
  <p>for narrowing.</p>
  <p>casting can remove the warnings but don't solve the safety issue.</p>
  <p>Is there a proper way of doing this?</p>