MISRA C:2023 Rule 17.12
A function identifier should only be used with either a preceding &
, or with a parenthesized parameter list
自 R2024a 起
描述
规则定义
A function identifier should only be used with either a preceding &
, or with a parenthesized parameter list 1
.
理由
使用函数标识符时,如果前面没有 &
,后面也没有带括号的参数列表,会造成混淆。不清楚其意图是调用函数还是获取函数的地址。
Polyspace 实现
如果使用函数标识符时没有满足以下任一条件,此规则检查项会报告违规:
前面有
&
后面跟着带括号的参数列表
故障排除
如果您预计存在违规,但未看到该违规,请参阅Diagnose Why Coding Standard Violations Do Not Appear as Expected。
示例
检查信息
组:函数 |
类别:建议 |
AGC 类别:建议 |
版本历史记录
在 R2024a 中推出
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.