"invalid pure specifier" 我的意思是没有纯说明符?
"invalid pure specifier" when I meant no pure specifier?
考虑以下片段:
class UltraProbe {
public:
ConnectProbe *CP() {
return probes.CP; // if type == UP_CONNECT
}
private:
probespec mypspec; /* Filled in by the appropriate set* function */
union {
IPExtraProbeData IP;
ConnectProbe *CP;
// ArpProbe *AP;
} probes;
};
bool do_one_select_round(UltraScanInfo *USI, struct timeval *stime) {
UltraProbe *probe = NULL;
int errno = (probe->CP()->connect_result);
}
为什么会出现以下错误?
scan_engine_connect.cc:592:22: error: invalid pure specifier (only ‘= 0’ is allowed) before ‘probe’
int errno = (probe->CP()->connect_result);
^
errno
是一个宏,它可能被解析为一个函数,所以我们有如下内容:
int errno_func() = (probe->CP()->connect_result);
因此编译器将其解释为试图声明一个函数。
考虑以下片段:
class UltraProbe {
public:
ConnectProbe *CP() {
return probes.CP; // if type == UP_CONNECT
}
private:
probespec mypspec; /* Filled in by the appropriate set* function */
union {
IPExtraProbeData IP;
ConnectProbe *CP;
// ArpProbe *AP;
} probes;
};
bool do_one_select_round(UltraScanInfo *USI, struct timeval *stime) {
UltraProbe *probe = NULL;
int errno = (probe->CP()->connect_result);
}
为什么会出现以下错误?
scan_engine_connect.cc:592:22: error: invalid pure specifier (only ‘= 0’ is allowed) before ‘probe’
int errno = (probe->CP()->connect_result);
^
errno
是一个宏,它可能被解析为一个函数,所以我们有如下内容:
int errno_func() = (probe->CP()->connect_result);
因此编译器将其解释为试图声明一个函数。