Skip to content

Commit 701c00a

Browse files
authored
chore: update .clang-format for mcpp style (#3) (#11)
1 parent fb19583 commit 701c00a

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

.clang-format

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
---
2-
# mcpp-style-ref: 匹配 README 中的格式规范
3-
# 1.4 空格: 符号两侧留空,如 int n { 42 }
4-
# 缩进: 4 空格
52
Language: Cpp
6-
Standard: c++23
3+
Standard: Latest
74

8-
IndentWidth: 4
9-
TabWidth: 4
10-
UseTab: Never
5+
IndentWidth: 4 # 缩进宽度:4空格
6+
TabWidth: 4 # Tab宽度:4空格
7+
UseTab: Never # 不使用Tab,只用空格
8+
AccessModifierOffset: -4 # 访问修饰符(public/private)向左缩进4空格
119

12-
# 大括号与声明同行 (class X {, void f() {)
13-
BreakBeforeBraces: Attach
10+
BreakBeforeBraces: Attach # 大括号附加在声明同行(如 if (x) {)
1411

15-
# 花括号初始化留空: T x { ... }
16-
SpaceBeforeCpp11BracedList: true
12+
PointerAlignment: Left # 指针/引用符号紧贴类型(int* p)
13+
14+
SpaceBeforeCpp11BracedList: true # 在 ) 和 { 之间加空格:func( {1, 2} )
15+
Cpp11BracedListStyle: false # 保留 {} 内部空格:{ 1, 2, 3 }
16+
17+
AlwaysBreakTemplateDeclarations: Yes # 模板声明总是换行:template<typename T>\nclass X
18+
19+
AllowShortFunctionsOnASingleLine: Empty # 只有空函数可以单行

0 commit comments

Comments
 (0)