Why sizeof built in types except char is compiler dependent in C & C++?
<p>Why are fundamental types in C and C++ not strictly defined like in Java where an <code>int</code> is always 4 bytes and <code>long</code> is 8 bytes, etc. To my knowledge in C and C++ only a <code>char</code> is defined as 1 byte and everything else is defined differently by different compilers. So an <code>int</code> in C and C++ does not have to necessarily be 4 bytes as long as it's longer than a <code>short</code> and <code>short</code> is longer <code>char</code>.<br>
I was just wondering why is that and does it serve any purpose?</p>