AUTOSAR C++14 Rule A2-3-1
Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code
Since R2020a
Description
Rule Definition
Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code.
Rationale
In the C++ standard, the basic source character set consists of 96 characters. They are:
The space character.
The control characters such as horizontal tab, vertical tab, form feed, and new line.
Upper and lowercase letters, and numbers.
Special characters, such as
_ { } [ ] # ( ) < > % : ; . ? * + - / ^ & | ~ ! = , \ " '
.
Using characters outside this set can cause confusion and unexpected bugs. For example, the Greek letter "Τ" is visually similar to the English letter "T", but they are separate characters with different Unicode code-point values. To avoid unexpected behavior, use only the above specified characters in your source code, including comments and string literals. You can use characters outside this set in only two cases. You can use:
Other characters inside the text of a wide string or a UTF-8 encoded string.
The character
@
inside comments, the text of a wide string, or a UTF-8 encoded string.
Polyspace Implementation
Polyspace® flags the characters in your source code that are not in the set of 96 characters specified in C++ standard, with two exceptions that come from the AUTOSAR C++14 Standard. Polyspace does not flag:
Other characters inside the text of a wide string or a UTF-8 encoded string.
The character
@
inside comments, the text of a wide string, or a UTF-8 encoded string.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Lexical conventions |
Category: Required, Automated |
Version History
Introduced in R2020a