指向 C++ 中具有未定义访问权限的类型的指针?

Pointer to type with undefined access right in C++?

C++ 有这 3 种类型 o char:

"Analogically", C++也有3种指针类型吗? :

在 C++ 中代替 ??? 有什么用?

C++不支持,"exact type of this type to be defined later in the program";有些类型是最好的 - "implementation is system dependent"。

所以在 C++ 中没有对应的东西。指针,任何指针,要么是 const 要么是非 const。

一个字符不是 "character which have not defined if its signed or unsigned"; c++ 标准 - "type for character representation which can be most efficiently processed on the target system (has the same representation and alignment as either signed char or unsigned char, but is always a distinct type)."。所以 char 总是 NOT undefined 类型之一。

您误认为 const int* 必然是指向 const int 的指针。示例:

int a; // Not const;
int const* p = &a; // Valid

因此,int const volatile*就是答案。它可以指向任何 cv 限定的 int.