Why is this an issue?
There is potential for confusion if an octal or hexadecimal escape sequence is immediately followed by other characters. Instead, such sequences
shall be terminated by either:
- The start of another escape sequence.
- The end of the character constant or the end of a string literal.
Noncompliant code example
const char *s1 = "\x41g"; // Noncompliant
int c1 = '\141t'; // Noncompliant
const char *s2 = "\x41" "g"; // Compliant - terminated by end of literal
const char *s3 = "\x41\x67"; // Compliant - terminated by another escape
int c2 = '\141\t'; // Compliant - terminated by another escape
- MISRA C:2012, 4.1 - Octal and hexadecimal escape sequences shall be terminated