AutosarC++19_03-A2.13.4¶
String literals shall not be assigned to non-constant pointers
Required inputs: IR
| Level | required |
|---|---|
| Target | architecture / design / implementation |
| Enforcement | automated |
Rationale
Since C++0x, there was a change in subclause 2.13.5 for string literals. To prevent from calling an inappropriate function that might modify its argument, the type of a string literal was changed from “array of char” to “array of const char”.
Such a usage is deprecated by the Standard and reported by a compiler as a warning.
This rule is deliberately redundant, in case rules A1-1-1 and A1-4-3 are disabled in a project.
See Also
- JSF December 2005 [8]: AV Rule 151.1: A string literal shall not be modified.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
cafe_message |
{} |
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
message_predicate¶
message_predicate : typing.Callable[[Cafe_Message], bool] | None = None
True for messages to
report.
reported_messages¶
reported_messages : set[int] | None = {2464}
reported_severities¶
reported_severities : set[str] = {'error', 'remark', 'warning'}
use_error_number¶
use_error_number : bool = False
use_rule_severity¶
use_rule_severity : bool = True