Skip to content

Unify C++ source and header file extensions #44196

@stephanosio

Description

@stephanosio

Overview

Currently, we have different file extensions for the C++ source and header files in the Zephyr repository:

Source Files

Header Files

For the sake of consistency, the project should decide on and use only single extension each for the C++ source and header files.

Context

Widely-used conventions

C++ source Files: .cpp, .cxx, .cc, C
C++ header Files: .hpp, .hxx, .hh, h

From the perspective of the Standard C++ Foundation

Opinions

Amongst the "widely-used conventions" listed above, some to avoid are:

  • C (capital C) for source files
    • This will not play well with the operating systems that do not strictly enforce the case sensitiveness of the file names (e.g. Windows, macOS).
    • This is more prone to human errors than having alphabetically different names for the C++ source files and the C source files.
  • h for C++ header files
    • This provides no distinction between the C++ header files and the C header files.

Proposed Change

  • Use .cpp for C++ source files.
  • Use .hpp for C++ header files.

Metadata

Metadata

Assignees

Labels

RFCRequest For Comments: want input from the communityarea: C++

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions