intint

xiaoxiao2025-08-21  47

转载自http://blog.sina.com.cn/s/blog_4b9eab320100sdex.html

32位平台:

char  1个字节8位

short  2个字节

int    4个字节

long   4个字节

long long   8个字节

float   4个字节

double    8个字节

指针    4个字节

64位平台:

char   1个字节

short   2个字节

int     4个字节

long 8个字节

long long   8个字节

float   4个字节

double   8个字节

指针  8个字节

因为long在不同的平台所占用的字节数不一样,为了保证平台的通用性,程序中尽量不要使用long数据库型。可以使用固定大小的数据类型宏定义:

还有一个原因就是:

在不同位宽的芯片中,比如8bit的芯片, 在表示8bit的数据时,总不能用char来表示吧 ,因此会重定义数据类型int_8t。

在16bit的芯片中也是同样的道理,变量用short int来表示不合适,因此需要重定义数据类型typedef short int  int_16t;

 

转载请注明原文地址: https://www.6miu.com/read-5035069.html

最新回复(0)