title: C++ Why numeric limits doesn't work for uint8_t and int8_t?
body: <p>I recently noticed numeric_limits::max() and numeric_limits::min() don't seem to work for uint8_t and int8_t. Is there a reason for this or could it be a bug? I tried on my own computer using gcc compiler:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;limits&gt;
  
  using namespace std;
  
  int main()
  {
  
      std::cout &lt;&lt; "numeric_limits&lt;uint8_t&gt;::max() = " &lt;&lt; numeric_limits&lt;uint8_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int8_t&gt;::max() = " &lt;&lt; numeric_limits&lt;int8_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int8_t&gt;::min() = " &lt;&lt; numeric_limits&lt;int8_t&gt;::min() &lt;&lt; std::endl;
  
      std::cout &lt;&lt; "numeric_limits&lt;uint16_t&gt;::max() = " &lt;&lt; numeric_limits&lt;uint16_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int16_t&gt;::max() = " &lt;&lt; numeric_limits&lt;int16_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int16_t&gt;::min() = " &lt;&lt; numeric_limits&lt;int16_t&gt;::min() &lt;&lt; std::endl; 
  
      std::cout &lt;&lt; "numeric_limits&lt;uint32_t&gt;::max() = " &lt;&lt; numeric_limits&lt;uint32_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int32_t&gt;::max() = " &lt;&lt; numeric_limits&lt;int32_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int32_t&gt;::min() = " &lt;&lt; numeric_limits&lt;int32_t&gt;::min() &lt;&lt; std::endl; 
  
      std::cout &lt;&lt; "numeric_limits&lt;uint64_t&gt;::max() = " &lt;&lt; numeric_limits&lt;uint64_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int64_t&gt;::max() = " &lt;&lt; numeric_limits&lt;int64_t&gt;::max() &lt;&lt; std::endl; 
      std::cout &lt;&lt; "numeric_limits&lt;int64_t&gt;::min() = " &lt;&lt; numeric_limits&lt;int64_t&gt;::min() &lt;&lt; std::endl; 
  
      return 0;
  }
  </code></pre>
  
  <p>gives output:</p>
  
  <pre><code>numeric_limits&lt;uint8_t&gt;::max() = �
  numeric_limits&lt;int8_t&gt;::max() = 
  numeric_limits&lt;int8_t&gt;::min() = �
  numeric_limits&lt;uint16_t&gt;::max() = 65535
  numeric_limits&lt;int16_t&gt;::max() = 32767
  numeric_limits&lt;int16_t&gt;::min() = -32768
  numeric_limits&lt;uint32_t&gt;::max() = 4294967295
  numeric_limits&lt;int32_t&gt;::max() = 2147483647
  numeric_limits&lt;int32_t&gt;::min() = -2147483648
  numeric_limits&lt;uint64_t&gt;::max() = 18446744073709551615
  numeric_limits&lt;int64_t&gt;::max() = 9223372036854775807
  numeric_limits&lt;int64_t&gt;::min() = -9223372036854775808
  </code></pre>