是柜面64位处理器的uint16_t和unsigned short int类型之间的区别? [英] what is the difference between uint16_t and unsigned short int incase of 64 bit processor?

查看:1678
本文介绍了是柜面64位处理器的uint16_t和unsigned short int类型之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来用一个变量,它的类型的uint16_t ,但我无法使用这些数据类型,因为我的项目限制。我可以使用无符号的短整型的地方uint16_t
我不知道什么是两者之间的差异。任何人都可以请你澄清?

I came to use a variable which is of type uint16_t, But i am unable to use that data type because of my project limitations. Can i use unsigned short int in the place of uint16_t? I don't know what is the difference between both of them. Can anybody please clarify?

推荐答案

uint16_t 是16位无符号整数。

uint16_t is unsigned 16-bit integer.

无符号的短整型是无符号的短整型,但大小依赖于实现。该标准只是说,这是至少16位(即, UINT_MAX 的最小值是 65535 )。在实践中,它通常是16位,但保证不能采取

unsigned short int is unsigned short integer, but the size is implementation dependent. The standard only says it's at least 16-bit (i.e, minimum value of UINT_MAX is 65535). In practice, it usually is 16-bit, but you can't take that as guaranteed.

请注意:


  1. 如果你想有一个便携式16位无符号整数,使用 uint16_t

  2. inttypes.h stdint.h 都在C99推出。如果使用的是C89,定义自己的类型。

  3. uint16_t 可能无法在某些实施中提供(请参见下面的参考),但无符号的短整型总是可用

  1. If you want a portable unsigned 16-bit integer, use uint16_t.
  2. inttypes.h and stdint.h are both introduced in C99. If you are using C89, define your own type.
  3. uint16_t may not be provided in certain implementation(See reference below), but unsigned short int is always available.

参考:C11(ISO / IEC 9899:201X)§7.20的整数类型

Reference: C11(ISO/IEC 9899:201x) §7.20 Integer types

对于这里的实现提供了描述每种类型)应宣布typedef名称和定义相关的宏。相反,对于本文的实现不提供描述每种类型,不得声明typedef名称也不得定义相关的宏。一个实现应提供描述为''需要'的类型,但不需要提供其他任何(被描述为'可选'')的。

For each type described herein that the implementation provides) shall declare that typedef name and define the associated macros. Conversely, for each type described herein that the implementation does not provide, shall not declare that typedef name nor shall it define the associated macros. An implementation shall provide those types described as ‘‘required’’, but need not provide any of the others (described as ‘optional’’).

这篇关于是柜面64位处理器的uint16_t和unsigned short int类型之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆