AutosarC++18_03-A7.1.4ΒΆ
The register keyword shall not be used
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
This feature was deprecated in the 2011 C++ Language Standard [2] and may be withdrawn in a later version.
Moreover, most compilers ignore register specifier and perform their own register assignments.
Example
// $Id: A7-1-4.cpp 289448 2017-10-04 11:11:03Z michal.szczepankiewicz $
#include <cstdint>
std::int32_t F1(register std::int16_t number) noexcept // Non-compliant
{
return ((number * number) + number);
}
void F2(std::int16_t number) noexcept // Compliant
{
register std::int8_t x = 10; // Non-compliant
std::int32_t result = F1(number); // Compliant
// ...
}
See Also
- JSF December 2005 [7]: AV Rule 140 The register storage class specifier shall not be used.
- HIC++ v4.0 [8]: 1.3.2 Do not use the register keyword
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
register_keyword |
The register keyword shall not be 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
This rule has no individual options.