2
考虑下面的代码片段:“无效纯说明符”当我的意思是没有纯粹说明符?
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);
^
...解决方案正在_to不重用现有的库名!!!! _ –
嗯,我还没有看到一个glibc实现,其中'errno'扩展为函数调用。它应该是一个左值整数表达式。一些手册页实际上称之为变量。 –
@LightnessRacesinOrbit我不记得在哪里(可能在某个模糊的嵌入式平台上),但是我已经看到'#define'd为'(* __ errno_pointer())'。 –