AutosarC++17_03-A7.1.4ΒΆ

The register keyword shall not be used

Required inputs: IR

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 271687 2017-03-23 08:57:35Z piotr.tanski $
#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