Question Details

No question body available.

Tags

c++ code-formatting clang-format

Answers (1)

Accepted Answer Available
Accepted Answer
October 8, 2025 Score: 8 Quality: High Completeness: 50%

set the following in your .clang-format:

IndentWidth: 2
IndentAccessModifiers: true     #gives access specifiers their own level

AccessModifierOffset: 0 #optional; ignored when IndentAccessModifiers is true

BreakBeforeBraces: Allman #optional; matches your brace style

With IndentAccessModifiers: true (clang-format 13+), public: is indented one level (2 spaces) and its members are indented one more level (4 spaces).

Please update your clang-format if its older than 13