AutosarC++17_10-A7.1.8ΒΆ
A non-type specifier shall be placed before a type specifier in a declaration
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
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 [8]: 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
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.