This rule is part of MISRA C++:2023.
Usage of this content is governed by Sonar’s terms and conditions. Redistribution is
prohibited.
Rule 5.0.1 - Trigraph-like sequences should not be used
Category: Advisory
Analysis: Decidable,Single Translation Unit
Amplification
Trigraph-like sequences occur when the following character sequences appear in the source code:
??= ??/ ??' ??( ??) ??! ??< ??> ??-
Rationale
Trigraphs were removed from the language in C++17. However, to prevent possible confusion, the sequences should not be used as it is unclear
whether their replacement is expected.
Example
const char * msg = "(Date format is ??-??-??)"; // Non-compliant
const char * msg = "(Date format is ?\?-?\?-?\?)"; // Compliant
Copyright The MISRA Consortium Limited © 2023