Chinaunix首页 | 论坛 | 博客
  • 博客访问: 196294
  • 博文数量: 42
  • 博客积分: 935
  • 博客等级: 准尉
  • 技术积分: 445
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-27 16:57
个人简介

.

文章分类

全部博文(42)

文章存档

2013年(2)

2012年(5)

2011年(35)

我的朋友

分类: C/C++

2011-04-21 18:39:05

今天看到size_t,查了一下wiki,解释如下:
  1. From Wikipedia, the free encyclopedia
  2. size_t is an unsigned data type defined by several C/C++ standards (e.g., the C99 ISO/IEC 9899 standard) that is defined in stddef.h.[1] It can be further imported by inclusion of stdlib.h as this file internally sub includes stddef.h.[2]

  3. This type is used to represent the size of an object. Library functions that take or return sizes expect them to be of type or have the return type ofsize_t. Further, the most frequently used compiler-based operator sizeof should evaluate to a value that is compatible with size_t.

  4. [edit]Range and storage size of size_t
  5. The actual type of size_t is platform-dependent; a common mistake is to assume size_t is the same as unsigned int, which can lead to programming errors,[3][4] when moving from 32 to 64-bit architecture, for example.

  6. According to the 1999 ISO C standard (C99), size_t is an unsigned integer type of at least 16 bits.

  7. [edit]Signed variant ssize_t
  8. In some implementations there is further a non-standard signed variant of this type with name ssize_t. The type definition for ssize_t is available in most Unix compatible systems. It was probably introduced by the second edition of the POSIX 1003.1 standard (1003.1-1996).[5]

  9. The ssize_t type follows the same rules as size_t for its storage size, location and inclusion, and uses the implementation's usual representation of signed values—2's complement in most, if not all, cases.
阅读(1202) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~