☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

函数取地址时应显式使用 & 运算符

14.23 ID_missingAddressOperator
目录 › next › previous

函数名称标识符可以隐式转换为函数指针或函数地址,但为了提高可读性,应对其有所区分。

示例:

int fun(void);
int(*pf)(void) = fun;   // Non-compliant, use ‘&fun’ instead

参考

MISRA C++ 2008 8-4-4
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.