AutosarC++17_10-A2.14.1¶
Only those escape sequences that are defined in ISO/IEC 14882:2014 shall be used
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
The use of an undefined escape sequence leads to undefined behavior. The defined escape sequences (ISO/IEC 14882:2014) are: \’, \", \?, \\, \a, \b, \f, \n, \r, \t, \v, \<Octal Number>, \x<Hexadecimal Number>, \U<Unicode Character Name>
Example
//% $Id: A2-14-1.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
#include <string>
void F() {
const std::string a = "\k"; // Non-compliant
const std::string b = "\n"; // Compliant
const std::string c = "\U0001f34c"; // Compliant
}
See Also
- MISRA C++ 2008 [6]: required 2-13-1 Only those escape sequences that are defined in ISO/IEC14882:2003 shall be used.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
nonstandard_escape_sequence |
Use of non-standard escape sequence. |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
allow_delimited_escape_sequences¶
allow_delimited_escape_sequences : bool = False
allowed¶
allowed : str = ''"?\abfnrtv'