AutosarC++18_10-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 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 [8]: AV Rule 140 The register storage class specifier shall not be used.
  • HIC++ v4.0 [9]: 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