现代C++中uintptr_t类型的头文件是什么

What is the header file for the uintptr_t type in modern C++?

本文关键字:文件 是什么 类型 C++ uintptr 现代      更新时间:2023-10-16

我发现在C99中应该使用#include <stdint.h>,这似乎也适用于我的C++03 gcc编译器,但这是现代C++的正确标头吗?它是可移植的吗?

在C++11中,它在<cstdint>中。

在该语言的旧版本中,它并没有正式存在;但许多编译器提供C99库作为扩展,在这种情况下,它将在<stdint.h>中可用。

它在stdint.h:中定义

#include <stdint.h>

在C++中,标准标头在cstdint

#include <cstdint>

包括cinttypescstdint

它在C99中,作为一种可选类型。许多C++03编译器都提供了该文件。它也在C++11中,在中,它也是可选的,它的定义引用了C99。包括stdint.h