From b184db882f8c6a45538b89e02203053c86269259 Mon Sep 17 00:00:00 2001 From: Creativecole Date: Sat, 28 Feb 2026 18:41:17 +0800 Subject: [PATCH] chore: update .clang-format for mcpp style (#3) --- .clang-format | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.clang-format b/.clang-format index 49a69df..4702c3b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,16 +1,19 @@ --- -# mcpp-style-ref: 匹配 README 中的格式规范 -# 1.4 空格: 符号两侧留空,如 int n { 42 } -# 缩进: 4 空格 Language: Cpp -Standard: c++23 +Standard: Latest -IndentWidth: 4 -TabWidth: 4 -UseTab: Never +IndentWidth: 4 # 缩进宽度:4空格 +TabWidth: 4 # Tab宽度:4空格 +UseTab: Never # 不使用Tab,只用空格 +AccessModifierOffset: -4 # 访问修饰符(public/private)向左缩进4空格 -# 大括号与声明同行 (class X {, void f() {) -BreakBeforeBraces: Attach +BreakBeforeBraces: Attach # 大括号附加在声明同行(如 if (x) {) -# 花括号初始化留空: T x { ... } -SpaceBeforeCpp11BracedList: true +PointerAlignment: Left # 指针/引用符号紧贴类型(int* p) + +SpaceBeforeCpp11BracedList: true # 在 ) 和 { 之间加空格:func( {1, 2} ) +Cpp11BracedListStyle: false # 保留 {} 内部空格:{ 1, 2, 3 } + +AlwaysBreakTemplateDeclarations: Yes # 模板声明总是换行:template\nclass X + +AllowShortFunctionsOnASingleLine: Empty # 只有空函数可以单行 \ No newline at end of file