c++ - LPCSTR 没有 'long' 并且 UINT_PTR 没有指针?

标签 c++ c pointers msdn

在此网站上:Windows Data Types

题目的问题出现了。

我认为 LP 代表长指针 - 但没有长指针。 UINT_PTR 代表 unsigned int 指针,我再次假设 - 但没有指针。

有人知道这件事的背景吗?

最佳答案

引用“长指针”(LP 类型):

在那里你有过的时代(奔腾之前)long and short pointers .由于 WINAPI 在那个时代已经存在,并且今天仍然试图与那个时代的代码保持兼容,因此 LPsomething 类型得以幸存。

引用UINT_PTR:

这是一个足以容纳指针值的整数。 C11 标准定义了这样一种类型:

7.20.1.4 Integer types capable of holding object pointers

1 The following type designates a signed integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer:

  intptr_t

The following type designates an unsigned integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer:

  uintptr_t

These types are optional.

关于c++ - LPCSTR 没有 'long' 并且 UINT_PTR 没有指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23567959/

相关文章:

c++ - 从 vi "like running cpp program without exiting vi."运行各种 c 或 cpp 开发任务

c - 将指针写入 GPIO 输出引脚的地址

c - 为什么代码会泄漏内存?

c++ - 无法从 'const std::string [3]' 转换为 'std::string'

c++ - Boost Asio udp 解析器返回错误的端点迭代器

c++ - 如何使用两个 for 循环执行唯一的洗牌

c++ - this->field 与 C++ 中的 this.field

c++ - strcmp 错误 'WCHAR [260]' 到 'const char *'

c - 非常具体的 c 数组,适合初学者

c++ - 使一维指针数组指向二维 vector 中的对象