AutosarC++18_03-A2.13.1

Only those escape sequences that are defined in ISO/IEC 14882:2014 shall be used

Required inputs: IR

Escape sequences not defined in the C and C++ standards are not portable across compilers and platforms. Non-standard sequences may be interpreted differently or not recognized at all, leading to unexpected string contents. Using only standard escape sequences ensures code portability and predictable behavior across different compilation environments.
Bad code (non-standard escape sequences):
const char* str = "Hello\eWorld";  // ERROR: \e not standard (compiler-dependent)
const char* invalid = "Path\n\q";  // ERROR: \q is not standard escape
Good code (standard escape sequences):
const char* str = "Hello\n";       // OK: standard newline
const char* tab = "Col1\tCol2";    // OK: standard tab
const char* quote = "Say \"Hi\"";  // OK: standard quote escape
Standard escape sequences:
\\     backslash
\'      single quote
\"      double quote
\?      question mark
\a      alert (bell)
\b      backspace
\f      form feed
\n      newline
\r      carriage return
\t      horizontal tab
\v      vertical tab
\nnn    octal (up to 3 digits)
\xhh    hexadecimal (any number of digits)
\uxxxx  unicode (exactly 4 hex digits, C++11)
\Uxxxxxxxx  unicode (exactly 8 hex digits, C++11)

Possible Messages

Key

Text

Severity

Disabled

nonstandard_escape_sequence

Use of non-standard escape sequence.

None

False

Options

allow_delimited_escape_sequences

allow_delimited_escape_sequences : bool = False

Whether to allow C++23 escape sequences that are delimited by curly braces. This includes the delimited escape sequences `\u{}`, `\x{}`, and `\o{}` as well as named universal character escapes of the form `\N{}`.
 

allowed

allowed : str = ''"?\abfnrtv'

List of allowed characters after backslash.