
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
40 lines
963 B
Plaintext
40 lines
963 B
Plaintext
== 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
|
|
|
|
[source,cpp]
|
|
----
|
|
const char *s1 = "\x41g"; // Noncompliant
|
|
int c1 = '\141t'; // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cpp]
|
|
----
|
|
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
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* MISRA C:2012, 4.1 - Octal and hexadecimal escape sequences shall be terminated
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|