标题:stdint.h中定义的扩展整数类型的作用
只看楼主
喜鹊王子
Rank: 1
等 级:新手上路
帖 子:105
专家分:0
注 册:2012-12-25
结帖率:89.74%
 问题点数:0 回复次数:0 
stdint.h中定义的扩展整数类型的作用
stdint.h中定义了标准的扩展整数类型,包括准确长度类型,最小长度类型、快速长度类型、最大长度类型,这么定义的好处是啥?为了便于移植吗?比如什么时候应该用最小长度类型呢?

/*   7.18.1.1     Exact-width   integer   types   */
typedef   signed   char   int8_t;
typedef   unsigned   char       uint8_t;
typedef   short     int16_t;
typedef   unsigned   short     uint16_t;
typedef   int     int32_t;
typedef   unsigned       uint32_t;
typedef   long   long     int64_t;
typedef   unsigned   long   long       uint64_t;

/*   7.18.1.2     Minimum-width   integer   types   */
typedef   signed   char   int_least8_t;
typedef   unsigned   char       uint_least8_t;
typedef   short     int_least16_t;
typedef   unsigned   short     uint_least16_t;
typedef   int     int_least32_t;
typedef   unsigned       uint_least32_t;
typedef   long   long     int_least64_t;
typedef   unsigned   long   long       uint_least64_t;

/*     7.18.1.3     Fastest   minimum-width   integer   types   
  *     Not   actually   guaranteed   to   be   fastest   for   all   purposes
  *     Here   we   use   the   exact-width   types   for   8   and   16-bit   ints.   
  */
typedef   char   int_fast8_t;
typedef   unsigned   char   uint_fast8_t;
typedef   short     int_fast16_t;
typedef   unsigned   short     uint_fast16_t;
typedef   int     int_fast32_t;
typedef   unsigned     int     uint_fast32_t;
typedef   long   long     int_fast64_t;
typedef   unsigned   long   long       uint_fast64_t;
2016-08-20 15:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-468045-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.863465 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved