メインコンテンツ

MISRA C++:2008 Rule 2-3-1

Trigraphs shall not be used.

説明

ルール定義

Trigraphs shall not be used. 1

根拠

3 文字表記は 2 つの疑問符に続いて 3 文字目に特定の文字を指定して表します。たとえば、'??-''~' (チルダ) 文字を表し、'??)'']' を表します。これらの 3 文字表記により、他の 2 つの疑問符の使用と誤って混同される可能性があります。

たとえば、文字列

"(Date should be in the form ??-??-??)"
は以下に変換されます。
"(Date should be in the form ~~]"
しかし、この変換は意図されていない可能性があります。

Polyspace 実装

ルール チェッカーは、文字列で使用されているかどうかに関わらず、3 文字表記の使用に対して違反を報告します。

トラブルシューティング

ルール違反が想定されるものの、Polyspace® から報告されない場合は、コーディング規約違反が想定どおりに表示されない理由の診断を参照してください。

チェック情報

グループ: Lexical Conventions
カテゴリ: 必要

バージョン履歴

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.