考虑以下代码片段:
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);
因此编译器将其解释为尝试声明函数。
关于c++ - "invalid pure specifier"当我的意思是没有纯说明符时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31092543/