Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何进行C++;函数指针的类型转换? //函数原型 总线主操作系统(总线串行*串行控制, 回调\u t响应\u cb, 回调参数回调参数=nullptr, 计时器超时, uint16_t tx_尺寸); typedef void*回调参数; 类型定义无效回调(回调参数句柄, uint8_t*数据、uint16_t长度、uint8_t错误); //函数调用,问题就在这里。 总线MasterOS(总线串行*串行ct, NulLPTR/*问题在这里,如何对这个值'null pTr' *进行C++风格的类型转换。 ,重新解释铸造(nullptr), 1000U, 5U);_C++ - Fatal编程技术网

如何进行C++;函数指针的类型转换? //函数原型 总线主操作系统(总线串行*串行控制, 回调\u t响应\u cb, 回调参数回调参数=nullptr, 计时器超时, uint16_t tx_尺寸); typedef void*回调参数; 类型定义无效回调(回调参数句柄, uint8_t*数据、uint16_t长度、uint8_t错误); //函数调用,问题就在这里。 总线MasterOS(总线串行*串行ct, NulLPTR/*问题在这里,如何对这个值'null pTr' *进行C++风格的类型转换。 ,重新解释铸造(nullptr), 1000U, 5U);

如何进行C++;函数指针的类型转换? //函数原型 总线主操作系统(总线串行*串行控制, 回调\u t响应\u cb, 回调参数回调参数=nullptr, 计时器超时, uint16_t tx_尺寸); typedef void*回调参数; 类型定义无效回调(回调参数句柄, uint8_t*数据、uint16_t长度、uint8_t错误); //函数调用,问题就在这里。 总线MasterOS(总线串行*串行ct, NulLPTR/*问题在这里,如何对这个值'null pTr' *进行C++风格的类型转换。 ,重新解释铸造(nullptr), 1000U, 5U);,c++,C++,您可以使用静态强制转换(nullptr),因为事实上您的原型会衰减到 //Function prototype Bus_MasterOS( Bus_Serial* serial_ctrl, callback_t response_cb, callback_param_t callback_param = nullptr, TIMERS_TD timeout , uint16_t tx_size ); typedef

您可以使用静态强制转换(nullptr),因为事实上您的原型会衰减到

//Function prototype        
Bus_MasterOS( Bus_Serial* serial_ctrl,
        callback_t response_cb,
        callback_param_t callback_param = nullptr,
        TIMERS_TD timeout ,
        uint16_t tx_size );

typedef void* callback_param_t;

typedef void callback_t( callback_param_t handle,
        uint8_t* data, uint16_t length, uint8_t error );

//Function call and the issue faces is here.            
Bus_MasterOS( Bus_Serial* serial_ct,
        nullptr/* issue is here, how to do the C++ style typecast to this value 'nullptr' */
                            ,reinterpret_cast<callback_param_t>(nullptr),
        1000U ,
        5U);

你不需要演员阵容
nullptr
可隐式转换为任何指针类型,包括函数指针。我们需要这样做以保持PC lint安静:(.这就是问题所在。有解决方案吗..获取PC Lint的更新版本?最好是支持C++11标准的版本?嗨,科迪,是的,这是最新的。将物流问题转化为工程问题的经典案例。将其升级到管理层,不要放弃,工具应该是帮助解决问题的,而不是制造问题。嗨,Jarod42,correc我没有回答,但我使用了reinterpret_cast,因为它涉及指针类型转换!请分享您的想法..并感谢您的回答。:)
void Bus_MasterOS(Bus_Serial* serial_ctrl,
                  callback_t* response_cb,
                  callback_param_t callback_param,
                  TIMERS_TD timeout,
                  uint16_t tx_size);