Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated font

...

All occurrences in a source file of the following sequences of three characters (that is, trigraph sequences) are replaced with the corresponding single character.

??=

#

 

??)

]

 

??!

|

??(

[

 

??'

^

 

??>

}

??/

\

 

??<

{

 

??-

~

 


Noncompliant Code Example

...

Inadvertent trigraphs can result in unexpected behavior. Some compilers provide options to warn when trigraphs are encountered or to disable trigraph expansion. Use the warning options, and ensure your code compiles cleanly. (See MSC00-C. Compile cleanly at high warning levels.)

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

PRE07-C

Low

Unlikely

Medium

P2

L3

Automated Detection

ToolVersionCheckerDescription
Astrée
Include Page
Astrée_V
Astrée_V
trigraphFully checked

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

CC2.PRE07

Fully implemented
GCC
Include Page
GCC_V
GCC_V
 

Can detect violation of this recommendation when the -Wtrigraphs flag is used

LDRA tool suite
Include Page
LDRA_V
LDRA_V

81 S

Fully implemented
Parasoft C/C++test
Include Page
c:
Parasoft_V
c:
Parasoft_V
MISRA2004-4_2-3Partially implemented
PRQA QA-C
Include Page
PRQA QA-C_v
PRQA QA-C_v
3601Partially implemented
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
trigraphFully checked
SonarQube C/C++ Plugin
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
TrigraphUsage
 

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

Bibliography

[ISO/IEC 9899:2011]Subclause 5.2.1.1, "Trigraph Sequences"

...


...