c语言类型探索:unsigned long

c语言类型探索:unsigned long

0x00 缘起

目前在做mib相关的工作,oid节点的类型是counter64,支持私有mib的类型使用的是unsigned long,在考虑是不是够用,组内给出的结论是我们的平台上unsigned long和unsigned long long是相同位宽,即都为8字节。感觉自己基本功不扎实,故才有了这次探索

0x01 测试

事实胜于雄辩,我还是在设备上做下测试吧。结果显示的却是如此,unsigned long和unsigned long long是相同位宽,即都为8字节。

printf("unsigned long size = %ld\n", sizeof(unsigned long);
printf("unsigned long size = %ld\n", sizeof(unsigned long long);

0x02 查看规范

§5.2.4.2.1节给出了相关范围说明。

5.2.4.2.1 Sizes of integer types <limits.h>
The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
following shall be replaced by expressions that have the same type as would an
exp
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值