Why does the data type long support a maximum number equal to long long's?
<p>So I was doing some testing with the new data type <strong>long long</strong> when I stumbled upon a little "problem" (example came from C++ Primer 6th edition).  I was using the climits library to tell me the maximum number supported by <strong>long</strong> and <strong>long long</strong> and both came out to 9223372036854775807.  How is that possible?</p>

<pre><code>#include &lt;iostream&gt; 
#include &lt;climits&gt;

int main()
{
    std::cout &lt;&lt; "int size is " &lt;&lt; sizeof(int) &lt;&lt; " bytes." &lt;&lt; std::endl;
    std::cout &lt;&lt; "short size is " &lt;&lt; sizeof(short) &lt;&lt; " bytes." &lt;&lt; std::endl;
    std::cout &lt;&lt; "long size is " &lt;&lt; sizeof(long) &lt;&lt; " bytes." &lt;&lt; std::endl;
    std::cout &lt;&lt; "long long size is " &lt;&lt; sizeof(long long) &lt;&lt; " bytes." &lt;&lt; std::endl;

    std::cout &lt;&lt; "Maximum values: " &lt;&lt; std::endl;
    std::cout &lt;&lt; "int: " &lt;&lt; INT_MAX &lt;&lt; std::endl;
    std::cout &lt;&lt; "short: " &lt;&lt; SHRT_MAX &lt;&lt; std::endl;
    std::cout &lt;&lt; "long: " &lt;&lt; LONG_MAX &lt;&lt; std::endl;
    std::cout &lt;&lt; "long long: " &lt;&lt; LLONG_MAX &lt;&lt; std::endl;

    return 0;
}
</code></pre>
