什么是C ++`unsigned`?

时间:2012-11-08 21:34:20

标签: c++

C ++中的unsigned类型是指什么?它与unsigned int完全相同吗?

[符合质量标准]

2 个答案:

答案 0 :(得分:4)

是的,它完全一样。有关类型说明符列表和相应的指定类型,请参见 7.1.6.2简单类型说明符[dcl.type.simple] 中的表10。 unsigned指定类型“unsigned int”,就像unsigned int指定类型“unsigned int”一样。

Specifier(s)            Type

_type-name_             the type named
_simple-template-id_    the type as defined in 14.2
char                    “char”
unsigned char           “unsigned char”
signed char             “signed char”
char16_t                “char16_t”
char32_t                “char32_t”
bool                    “bool”
unsigned                “unsigned int”       <<<<<<<<<<<<<
unsigned int            “unsigned int”
signed                  “int”
signed int              “int”
int                     “int”
unsigned short int      “unsigned short int”
unsigned short          “unsigned short int”
unsigned long int       “unsigned long int”
unsigned long           “unsigned long int”
unsigned long long int  “unsigned long long int”
unsigned long long      “unsigned long long int”
signed long int         “long int”
signed long             “long int”
signed long long int    “long long int”
signed long long        “long long int”
long long int           “long long int”
long long               “long long int”
long int                “long int”
long                    “long int”
signed short int        “short int”
signed short            “short int”
short int               “short int”
short                   “short int”
wchar_t                 “wchar_t”
float                   “float”
double                  “double”
long double             “long double”
void                    “void”
auto                    placeholder for a type to be deduced
decltype(_expression_)  the type as defined below

答案 1 :(得分:2)

是的,它是一样的。

参考:http://en.cppreference.com/w/cpp/language/types