不一样平台下C\C++数值数据类型长度以下:linux
类型 win32 win64 linux32 linux64ui
其中long类型和指针类型须要特别注意,编写跨平台的软件时尽可能不要使用long类型,或者须要对long类型作特殊处理
--------------------- spa
由上图能够说明, long在linux下64位与win64位下表现不一致。这可能会致使一些精度问题,需注意。
推荐使用std一套有关整形的申明, 详细请参阅stdint.h指针
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
---------------------
blog