Main Content

AUTOSAR C++14 Rule A3-1-2

Header files, that are defined locally in the project, shall have a file name extension of one of: .h, .hpp or .hxx

Description

Rule Definition

Header files, that are defined locally in the project, shall have a file name extension of one of: .h, .hpp or .hxx.

Rationale

Developers and code reviewers expect a header file to have one of the standard file name extensions.

Polyspace Implementation

The rule checker flags files included with the #include directive with names that have an extension other than .h, .hpp or .hxx. For instance:

#include <header.c>
#include <header2.cpp>
Instead of <...>, if you use "..." around the file, the checker also flags the case where the file does not have an extension at all.

The checker does not flag the following inclusions:

The checker is case-insensitive.

Troubleshooting

If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Basic Concepts
Category: Required, Automated

Version History

Introduced in R2019b