C++ 语法:void CLASS functionName()? [英] C++ syntax: void CLASS functionName()?
问题描述
我遇到了一些没有标题的独立代码.我相信它是直接的 C/C++,但我不确定.如果是这样,下面的CLASS"是什么意思?我知道这不是类声明或定义.这是一个名为CLASS"的类的方法吗?
I came across some standalone code without headers. I believe it to be straight C/C++, but am not sure. If so, what does the "CLASS" in the following mean? I know it's not a class declaration or definition. Is this a method of a class named "CLASS"?
void CLASS functionName(){
//
//
//
}
我看惯了
,但不是上面的.我是不是忘记了什么?(原谅我,因为我最近一直在研究 JS 和 Objective-C.)
I'm used to seeing <returnType> <functionName>() {...}
, but not the above. Am I forgetting something? (Pardon me, as I've been in JS and Objective-C lately.)
推荐答案
虽然 AFAIK 不常见,但可能是 CLASS 是一个宏,如下所示.因为它的名字是 CLASS
,我会说它更有可能是一个类或命名空间的宏.
Although it's not common AFAIK, it could be that CLASS is a macro as below. Since its name is CLASS
, I would say it's more likely that it's a macro for a class or namespace.
1.班级名称
class A
{
void functionName();
};
#define CLASS A::
void CLASS functionName()
{}
2.命名空间
namespace A
{
void functionName();
};
#define CLASS A::
void CLASS functionName()
{}
3.调用转换
// or __cdecl, etc.
define CLASS __stdcall
4.其他
可能还有其他语法正确的(例如,指针的宏),但在您的情况下不太可能.或者它可能只是一个评论,正如 Hostile 在下面指出的那样.
There could be others (e.g., a macro for a pointer) which are syntactically correct, but they're less likely in your case. Or it could simply be a comment, as Hostile points out below.
这篇关于C++ 语法:void CLASS functionName()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!