标签:
没事玩玩。
1 #include <iostream> 2 3 4 #define TEST_TYPE(type) {std::cout<< #type << " : " <<sizeof(type)<<std::endl;} 5 6 int main() 7 { 8 TEST_TYPE(bool); 9 10 TEST_TYPE(char); 11 TEST_TYPE(signed char); 12 TEST_TYPE(unsigned char); 13 TEST_TYPE(wchar_t); 14 TEST_TYPE(char16_t); 15 TEST_TYPE(char32_t); 16 17 TEST_TYPE(short); 18 TEST_TYPE(int); 19 TEST_TYPE(long); 20 TEST_TYPE(long long); 21 22 TEST_TYPE(float); 23 TEST_TYPE(double); 24 TEST_TYPE(long double); 25 26 TEST_TYPE(unsigned short); 27 TEST_TYPE(unsigned int); 28 TEST_TYPE(unsigned long); 29 TEST_TYPE(unsigned long long); 30 31 std::getchar(); 32 return 0; 33 }
我这边的结果:MSVC(VS2015)
bool : 1
char : 1
signed char : 1
unsigned char : 1
wchar_t : 2
char16_t : 2
char32_t : 4
short : 2
int : 4
long : 4
long long : 8
float : 4
double : 8
long double : 8
unsigned short : 2
unsigned int : 4
unsigned long : 4
unsigned long long : 8
标签:
原文地址:http://www.cnblogs.com/sinx/p/5797654.html