在通信协议里,一个数据帧包含有命令字,而每个命令字对应的程序,用函数指针是最方便的。
现在遇到的问题是,在原来版本编译器里可用的函数指针,高的版本编译器不可用,提示非标准成员函数.....
原来编译器: MDK ARM V3.23 , 可用
现在编译器: MDK ARM V4.10 ,报错
// 类定义
Clase GPRSCls
{
// 成员函数
}
// 函数表
void (GPRSCls::*TH_DownloadCmdProcessTab[TH_DOWNLOAD_CMD_TOTAL_NUM])(uchar *p)=
{
(GPRSCls::AckAlarm ),
(GPRSCls::ClearWorkTime ),
(GPRSCls::LocationQuery ),
(GPRSCls::SetCenterNumber ),
(GPRSCls::InhibitSendSMS ),
(GPRSCls::SetDelayAlarmTime ),
(GPRSCls::RemoteOilControl ),
(GPRSCls::SetEleRail ),
(GPRSCls::SetIP_Port ),
(GPRSCls::SetCenterNumber1 ),
(GPRSCls::CameraProccess ),
(GPRSCls::UnlockVehicle ),
(GPRSCls::ReadSensorData ),
(GPRSCls::PulsOutput ),
(GPRSCls::SystemCoolBoot ),
(GPRSCls::ClearAlarmFlag ),
(GPRSCls::ReadTatolMileage ),
(GPRSCls::ReadIP_PortAndInterval ),
(GPRSCls::ReadSMS_Number ),
(GPRSCls::Calling_GPS ),
(GPRSCls::Set_GY_IP ),
(GPRSCls::SetReturnTime ),
(GPRSCls::SetLimitSpeed ),
(GPRSCls::SetParkOverTimeAlarm ),
(GPRSCls::RemoteMonitor ),
(GPRSCls::VersionQuery ),
(GPRSCls::RemoteLockDoor ),
(GPRSCls::SetUserNumber ),
(GPRSCls::ParameterStatusQuery ),
(GPRSCls::SetHideMode ),
(GPRSCls::RemoteChangeHandlePwd ),
(GPRSCls::RemoteOpenCallFunction ),
(GPRSCls::RemoteOpenAlarmFunction ),
(GPRSCls::RestoreFactorySetting ),
(GPRSCls::SetReturnParameter ),
(GPRSCls::SetHelpNumber ),
(GPRSCls::RecvSchedulMessage ),
(GPRSCls::GetAnalogValue ),
(GPRSCls::PhoneSchedulFunction ),
(GPRSCls::SetEnableCheckFlag ),
(GPRSCls::ReadEnableCheckFlag ),
(GPRSCls::SetPowerSaveMode ),
(GPRSCls::SetHanldeFactoryPassword ),
(GPRSCls::SetHanldeWatchCar ),
(GPRSCls::SetGPRS_CommunicateMode ),
(GPRSCls::RemoteSetScan ),
(GPRSCls::RemoteUpgrade ),
(GPRSCls::SetHighLowLevel ),
(GPRSCls::GetMessageRecord ),
};
void Fun(void)
{
void (GPRSCls::*pExecuteCmd)(uchar *pPS); // 定义函数指针
// ......
pExecuteCmd = TH_DownloadCmdProcessTab[i];
(GPRS.*pExecuteCmd)(PSC); // 执行各命令字对应的处理函数
// ......
}
函数表报错如下:
error: #504-D: nonstandard form for taking the address of a member function |