MISRAC2012-Rule-4.1
In this section:
Synopsis
(Required) Octal or hexadecimal escape sequences shall be terminated.
Enabled by default
Yes
Severity/Certainty
Low/Low

Full description
An octal or hexadecimal escape sequence was found that is not terminated. This check is identical to MISRAC++2023-5.13.2.
Coding standards
- MISRA C++ 2023 5.13.2
(Required) Octal escape sequences, hexadecimal escape sequences and universal character names shall be terminated
Code examples
The following code example fails the check and will give a warning:
/* string */ const char *s1 = "\x32x"; const char *s2 = "\122x"; /* wide char */ int w1 = '\122n'; int w2 = '\x32n';
The following code example passes the check and will not give a warning about this issue:
/* string */ const char *s1 = "\x32" "n"; const char *s2 = "\122" "n"; const char *s3 = "\x32\x33"; const char *s4 = "\122\123"; /* wide char */ int w1 = '\122\n'; int w2 = '\x32\n'; /* char */ unsigned char c1 = '\x32'; unsigned char c2 = '\122';