关于一些C语言类型的问题

  1. 按标准来说 ,最难辨别的几个大小类型应该如下大小:
    long >= int >= short

  2. 按自身理解(仅仅个人意见),long和short真实应该是long int和short int ,从而区分为32位还是16位。
    但int应该是需要根据不同的编译器来区分的,如在16位编译时,就是16位长度。

  3. 按在有些公司的建议,有些程序不会建议使用int(因为对于不同MCU可能会导致不同的长度,从而使移植和复用变得麻烦),而是使用long和short,这样可以更好的使模块进行移植和使用。

  4. 从网上总结的部分数据类型大小,只写了位的大小,请注意有符号和无符号的取值范围。

TypeSize
char8bit
short16bit
long32bit
float32bit
double64bit
/*Type definition of standard type BOOL*/
typedef unsigned char BOOL;
/*Type definition of standard type U8*/
typedef unsigned char U8;
/*Type definition of standard type U16*/
typedef unsigned short U16;
/*Type definition of standard type U32*/
typedef unsigned long U32;
/*Type definition of standard type U64*/
typedef unsigned long long U64;
/*Type definition of standard type S8*/
typedef signed char S8;
/*Type definition of standard type S16*/
typedef signed short S16;
/*Type definition of standard type S32*/
typedef signed long S32;
/*Type definition of standard type S64*/
typedef signed long long S64;
/*Type definition of standard type F32*/
typedef float F32;
/*Type definition of standard type F64*/
typedef double F64;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值