The use of an undefined escape sequence leads to undefined behavior.
Escape sequences supported in every C and C++ standard are: \n
, \t
, \v
, \b
, \r
,
\f
, \a
, \\
, \?
, \'
, \"
, \<Octal Number>
, and
\x<Hexadecimal Number>
.
C99 and C++11 introduced escape sequences for Unicode characters in the form: \u<4 Hexadecimal Digits>
and \U<8
Hexidecimal Digits>
.
C++23 supports named escape sequences for Unicode characters in the form \N{<Name of Character>}
and a delimited version of
escape sequences is supported: \o{<Octal Number>}
, \x{<Hexadecimal Number>}
, and \u{<Hexadecimal
Number>}
.
Noncompliant code example
const char_t a[ 2 ] = "\k"; // Noncompliant
const char_t b[ 2 ] = "\b"; // Compliant