::struct 在这种情况下是什么意思?

What does ::struct mean in this context?

我不知道如何搜索这个,因为 google 在我的搜索中似乎忽略了 ::

我在伪代码中有以下行: (此上下文中的玩家定义为:Player *player

if ( player == ::player )

我的意思是,如果 var playerplayer 类型。但这对我来说没有意义,因为编译器应该知道它是什么类型。

So what does ::player mean here?

我没有足够的代表发表评论。所以把它变成了一个完整的答案。

通常 :: 运算符用作 Scope resolution operator.

根据语言的不同,在您的示例中,因为没有前置命名空间,所以它会引用全局 player

来自链接页面:

class A {
public:
    static int i; // scope of A
};

namespace B {
    int j = 2;
}  // namespace B

int A::i = 4;  // scope operator refers to the integer i declared in the class A
int x = B::j;  // scope operator refers to the integer j declared in the namespace B

在 IDA 的上下文中,它可能是它自己引用全局 player 对象的方式。

所以在你的例子中:

if ( player == ::player )

开发人员明确强制将本地 player 对象/变量与全局命名空间中的 player object/variable 进行比较。

这里有一个 simple online demo 可能会有所帮助。 avar 原始变量可以是更复杂的对象,class 或函数而不是 int。