是size_t总是unsigned? [英] is size_t always unsigned?
本文介绍了是size_t总是unsigned?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
标题:size_t总是无符号,即 size_t x
是 x
总是> = 0
?
As title: is size_t always unsigned, i.e. for size_t x
, is x
always >= 0
?
推荐答案
是。通常定义为类似以下内容(在32位系统上):
Yes. It's usually defined as something like the following (on 32-bit systems):
typedef unsigned int size_t;
参考:
在C标准中定义 size_t
在< cstddef>
中< stddef .h>
。
C标准节4.1.5将 size_t
定义为 sizeof
运算符
C++ Standard Section 18.1 defines size_t
is in <cstddef>
which is described in C Standard as <stddef.h>
.
C Standard Section 4.1.5 defines size_t
as an unsigned integral type of the result of the sizeof
operator
这篇关于是size_t总是unsigned?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文