AutosarC++17_03-M5.0.11¶
The plain char type shall only be used for the storage and use of character values
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
[Implementation 3.9.1(1), 7.1.5.2(1)]
Rationale
The char type within C++ is defined for use with the implementation character set. It is implementation-defined if char is signed or unsigned, and it is therefore unsuitable for use with numeric data.
Character values consist of character literals or strings. A character set maps text characters onto numeric values; the character value is the text itself.
Note that Rule 3.9.2 applies, so this rule also covers the char_t type.
Example
char_t a = 'a'; // Compliant
char_t b = '\r'; // Compliant
char_t c = 10; // Non-compliant
char d = 'd'; // Compliant with this rule, but breaks Rule 3.9.2
See also
Rule 3.9.2, Rule 5.0.12
Note
For legal reasons, this rule’s description is not part of the public documentation.