Type Sizes
From the makers of InspIRCd.
Contents |
Type sizes on various machines, for reference
This is mainly a developer resource, please contribute your system results if you have a notably different system, or a similar system with different results.
C++ rules on type sizes
1 === sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) 1 <= sizeof(bool) <= sizeof(long) sizeof(char) <= sizeof(wchar_t) <= sizeof(long) sizeof(float) <= sizeof(double) <= sizeof(long double) N == (char, short, int, long) sizeof(N) === sizeof(unsigned N) === sizeof(signed N) char >= 8 bits short >= 16 bits long >= 32 bits
System Results
All results generated with the following C++ program:
#include <iostream>
#define PRINT(x) (std::cout << "sizeof(" #x ") = " << sizeof(x) << std::endl)
int main()
{
PRINT(bool);
PRINT(char);
PRINT(wchar_t);
PRINT(short);
PRINT(int);
PRINT(float);
PRINT(double);
PRINT(long double);
PRINT(long);
PRINT(long long);
return 0;
}
AMD64 Gentoo Linux 64bit, GCC Gentoo 3.4.6-r1
sizeof(bool) = 1 sizeof(char) = 1 sizeof(wchar_t) = 4 sizeof(short) = 2 sizeof(int) = 4 sizeof(float) = 4 sizeof(double) = 8 sizeof(long double) = 16 sizeof(long) = 8 sizeof(long long) = 8
i386 FreeBSD 32bit, GCC 3.4.2 [FreeBSD]
sizeof(bool) = 1 sizeof(char) = 1 sizeof(wchar_t) = 4 sizeof(short) = 2 sizeof(int) = 4 sizeof(float) = 4 sizeof(double) = 8 sizeof(long double) = 12 sizeof(long) = 4 sizeof(long long) = 8

















