Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, it depends on Compiler. Compiler in turns usually depends on the architecture, processor, development environment etc because it takes them into account. So you may say it's a combination of all. <strong>But I would NOT say that. I would say, Compiler</strong>, since on the same machine you may have different sizes of POD and <em>built-in</em> types, if you use different compilers. Also note that your source code is input to the compiler, so it's the compiler which makes <strong>final</strong> decision of the sizes of POD and built-in types. However, it's also true that this decision is influenced by the underlying architecture of the target machine. After all, the real <strong><em>useful</em></strong> compiler <strong>has to</strong> emit <em>efficient</em> code that eventually runs on the machine you target.</p> <p>Compilers provides <code>options</code> too. Few of them might effect sizes also!</p> <hr> <h1>EDIT: What Standards say,</h1> <p><br/></p> <p>Size of <code>char</code>, <code>signed char</code> and <code>unsigned char</code> is defined by C++ Standard itself! Sizes of all other types are defined by the compiler.</p> <p>C++03 Standard $5.3.3/1 says,</p> <blockquote> <p>sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1; the result of sizeof applied to <strong>any other</strong> fundamental type (3.9.1) is implementation-defined. [Note: in particular,sizeof(bool) and sizeof(wchar_t) are implementation-defined.69)</p> </blockquote> <p>C99 Standard ($6.5.3.4) also itself defines the size of <code>char</code>, <code>signed char</code> and <code>unsigned char</code> to be 1, but leaves the size of other types to be defined by the compiler!</p> <hr> <p>EDIT:</p> <p>I found this C++ FAQ chapter really good. The entire chapter. It's very tiny chapter though. :-)</p> <p><a href="http://www.parashift.com/c++-faq-lite/intrinsic-types.html" rel="nofollow">http://www.parashift.com/c++-faq-lite/intrinsic-types.html</a></p> <hr> <p>Also read the comments below, there are some good arguments!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload