Windows系统,VS和GCC下各种数据类型大小的比较

两个编译器一个是VS2015,一个是MinGW64(GCC6.3)

#include"iostream"
using namespace std;

int main()
{
	cout<<"Size of unsigned char="<<sizeof(unsigned char)<<endl;
	cout<<"Size of signed char="<<sizeof(char)<<endl;
	cout<<"Size of unsigned int="<<sizeof(unsigned int)<<endl;
	cout<<"Size of short int="<<sizeof(short int)<<endl;
	cout<<"Size of int="<<sizeof(int)<<endl;
	cout<<"Size of long int="<<sizeof(long int)<<endl;
	cout<<"Size of long long int="<<sizeof(long long int)<<endl;
	cout<<"Size of double="<<sizeof(double)<<endl;
	cout<<"Size of float="<<sizeof(float)<<endl;
	cout<<"Size of long double="<<sizeof(long double)<<endl;
	return 0;
}

VS编译运行结果:


下面是GCC6.3.0


可以发现只有long double不一样,注CPU字长是64,系统是64位

猜你喜欢

转载自blog.csdn.net/Namcodream521/article/details/62219772
今日推荐