AutosarC++19_03-A7.1.8ΒΆ

A non-type specifier shall be placed before a type specifier in a declaration

Required inputs: IR

Rationale

Placing a non-type specifier, i.e. typedef, friend, constexpr, register, static, extern, thread_local, mutable, inline, virtual, explicit, before type specifiers makes the source code more readable.

Example
// $Id: A7-1-8.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
    #include <cstdint>

    typedef std::int32_t int1;    // Compliant
    std::int32_t typedef int2;    // Non-compliant

    class C
    {
       public:
         virtual inline void F1(); // Compliant
         inline virtual void F2(); // Compliant
         void virtual inline F3(); // Non-compliant
       private:
         std::int32_t mutable x; // Non-compliant
         mutable std::int32_t y; // Compliant
    };
See Also
  • HIC++ v4.0 [9]: 7.1.3 Do not place type specifiers before non-type specifiers in a declaration.

Possible Messages

Key

Text

Severity

Disabled

specifier_order

Non-Type specifier(s) {} used after type specifier.

None

False

Options