MISRAC++2023-5.13.2
In this section:
Synopsis
(Required) Octal escape sequences, hexadecimal escape sequences and universal character names shall be terminated
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Escape sequence not properly terminated This check is identical to MISRAC2012-Rule-4.1.
Coding standards
- MISRA C:2012 Rule-4.1
(Required) Octal and hexadecimal escape sequences 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';