【发布时间】:2012-11-18 12:47:06
【问题描述】:
stdint.h 和 cstdint 有什么区别?
它们都在 MSVC (Visual Studio 2010) 和 gcc-4.5.1 中可用。还都定义了intX_t/uintX_t 类型(其中X 是类型的字节大小)。
- 如果两个标题中的基本原理相同(便携式类型),我必须做出哪些决定来决定其中一个?
stdint.h 定义了没有任何命名空间的每个类型,cstdint 类型位于 std 命名空间中。
- 是否有任何理由将定义的类型包含或不包含到
std命名空间中?这两个标题有什么不同?
cstdint 没有文件扩展名并使用c 前缀,stdint.h 使用.h 扩展名。
- 此标头的命名约定是什么?
c前缀表示这是一个 C 库?cstdint中缺少文件扩展名是有原因的吗?
【问题讨论】:
-
OS X 10.8 缺少
<cstdint>。这是我收到的错误:./misc.h:7:10: fatal error: 'cstdint' file not found.