I\'m looking for detailed information regarding the size of basic C++ types. I know that it depends on the architecture (16 bits, 32 bits, 64 bits) and the compiler.
There is a standard and it is specified in the various standards documents (ISO, ANSI and whatnot).
Wikipedia has a great page explaining the various types and the max they may store: Integer in Computer Science.
However even with a standard C++ compiler you can find out relatively easily using the following code snippet:
#include
#include
int main() {
// Change the template parameter to the various different types.
std::cout << std::numeric_limits::max() << std::endl;
}
Documentation for std::numeric_limits can be found at Roguewave. It includes a plethora of other commands you can call to find out the various limits. This can be used with any arbitrary type that conveys size, for example std::streamsize.
John's answer contains the best description, as those are guaranteed to hold. No matter what platform you are on, there is another good page that goes into more detail as to how many bits each type MUST contain: int types, which are defined in the standard.
I hope this helps!