MISRA C:2012 Rule 5.2
Identifiers declared in the same scope and name space shall be distinct
説明
ルール定義
Identifiers declared in the same scope and name space shall be distinct 1 .
根拠
2 つの長い名前がほぼ同一で、違いが名前の後半部分のみである場合、それらを間違いやすくなります。コードの可読性は低下します。
Polyspace 実装
Polyspace® は最初の 63 文字の間に相違点があれば 2 つの名前を別個であると見なします。C90 では、相違点は最初の 31 文字の間に存在しなければなりません。C90 ルール チェックを使用するには、オプション [C 標準バージョン] (-c-version) で値 c90 を使用します。比較する文字数は、オプション -code-behavior-specifications を使用して変更できます。-code-behavior-specifications を参照してください。
レポート内の追加のメッセージ
Identifier XX has same significant characters as identifier YY.
トラブルシューティング
ルール違反を想定していてもその違反が表示されない場合、コーディング規約違反が想定どおりに表示されない理由の診断を参照します。
例
チェック情報
| グループ: 識別子 |
| カテゴリ: 必要 |
| AGC カテゴリ: 必要 |
バージョン履歴
R2014b で導入
参考
MISRA C:2012 Rule 5.1 | MISRA C:2012 Rule 5.3 | MISRA C:2012 Rule 5.4 | MISRA C:2012 Rule 5.5 | MISRA C:2012 のチェック (-misra3)
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.