AutosarC++18_10-A2.5.1¶
Trigraphs shall not be used
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
Trigraphs are denoted to be a sequence of 2 question marks followed by a specified third character (e.g. ??’ represents a ~character. They can cause accidental confusion with other uses of two question marks.
The Trigraphs are: ??=, ??/, ??’, ??(, ??), ??!, ??<, ??>, ??-.
Example
//% $Id: A2-5-1.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
#include <iostream>
void Fn1()
{
std::cout << "Enter date ??/??/??"; // Non-compliant, ??/??/?? becomes \\??
// after trigraph translation
}
void Fn2()
{
std::cout << "Enter date dd/mm/yy"; // Compliant
}
See Also
- MISRA C++2008: Rule 2-3-1 (Required) Trigraphs shall not be used.
- JSF December 2005 [8]: AV Rule 11 Trigraphs will not be used.
- HIC++ v4.0 [9]: 2.2.1 Do not use digraphs or trigraphs.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
trigraph_use |
Use of trigraph. |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
allow_in_comments¶
allow_in_comments : bool = True
Exception: a trigraph at the end of a line that might be interpreted as a line continuation is not allowed even if this option is enabled.