AutosarC++17_10-A2.2.1¶
Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
“The basic source character set consists of 96 characters: the space character, the control characters representing horizontal tab, vertical tab, form feed, and new-line, plus the following 91 graphical characters: a b c d e f g h i j k l m n o p q r s t u v w x y zABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_{}[]#( ) < > % : ; . ? * + - / ^ & | ~ ! =, \ " ’ ” [C++ Language Standard [3]]
Exceptions
It is permitted to use other characters inside the text of a wide string.
A character @ does not violate the rule. See rule A2-8-3.
Example
// $Id: A2-2-1.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
#include <cstdint>
void Fn() noexcept {
std::int32_t sum = 0; // Compliant
// std::int32_t £_value = 10; // Non-compliant
// sum += £_value; // Non-compliant
// Variable sum stores £ pounds // Non-compliant
}
See Also
- JSF December 2005 [7]: AV Rule 9: Only those characters specified in the C++ basic source character set will be used.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
forbidden_characters |
Forbidden characters used. |
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_in_comments¶
allow_in_comments : bool = False
allow_in_unicode_strings¶
allow_in_unicode_strings : bool = False
allow_in_wide_strings¶
allow_in_wide_strings : bool = True
basic_characters_list¶
basic_characters_list
The basic character list as per rule.Type: str
Default:
' \t\v\f\r\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\{\}\[\]\#\(\)<>%:;\.\?\*\+\-/\^\&\|\~!=,\\"'\(\)@'