このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
MISRA C++:2008 Rule 8-4-2
The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration.
説明
ルール定義
The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration. 1
根拠
再宣言で異なる識別子を使用すると、開発者が混乱する可能性があります。関数宣言と関数の再宣言で同じパラメーター識別子を使用することで、理解、保守、文書化しやすいコードになります。
Polyspace 実装
チェッカーは、次の間でのパラメーター名の不一致を検出します。
関数宣言とそれに対応する関数定義。
同じファイル内の 1 つの関数の 2 つの宣言。
これらの宣言がそれぞれ異なるファイルで行われている場合、チェッカーは、パラメーター名の不一致に対する違反を報告しません。複数の異なるファイルでの同じ関数の再宣言は、
MISRA C++:2008 Rule 3-2-3
に対する違反となります。
トラブルシューティング
ルール違反が想定されるものの、Polyspace® から報告されない場合は、コーディング規約違反が想定どおりに表示されない理由の診断を参照してください。
例
チェック情報
グループ: Declarators |
カテゴリ: 必要 |
バージョン履歴
R2013b で導入
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.