clangformat配置

1. 一个clangformat的参数参考值

BasedOnStyle: Google
Language: Cpp

AllowShortFunctionsOnASingleLine: Empty
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlignAfterOpenBracket: Align
BinPackArguments: false
BinPackParameters: true
BreakBeforeBraces: Allman
PenaltyBreakBeforeFirstCallParameter: 200
ColumnLimit: 100
ContinuationIndentWidth: 2
DerivePointerAlignment: false
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
SortIncludes: true
SpaceBeforeAssignmentOperators: true
SpacesBeforeTrailingComments: 1
SpacesInCStyleCastParentheses: false
SpaceInEmptyParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never
                   



这段代码是用于格式化C语言代码的配置文件。它定义了一系列的格式化参数,以便根据这些参数的设置对C代码进行格式化。这些参数包括:
1. `BinPackParameters`:设置是否对参数进行分组pack,以减少函数参数的内存消耗。取值范围为`true``false`2. `BreakBeforeBraces`:设置在函数或控制结构之前是否换行,取值范围为`Allman``GNU``Mozilla`3. `ColumnLimit`:设置每行代码的最大宽度,取值范围为正整数。
4. `ContinuationIndentWidth`:设置continuation lines(当一行代码超过ColumnLimit时产生的多行代码)的缩进宽度,取值范围为正整数。
5. `DerivePointerAlignment`:设置是否从指针类型 derive pointer alignment。取值范围为`true``false`6. `IncludeBlocks`:设置是否保留空行开始的include块,取值范围为`Preserve``Delete``Merge"。
7. `IndentCaseLabels`:设置是否对case标签进行缩进,取值范围为`true``false`8. `IndentWidth`:设置基本缩进宽度,取值范围为正整数。
9. `KeepEmptyLinesAtTheStartOfBlocks`:设置是否保留函数或控制结构开始处的空行,取值范围为`true``false`10. `MaxEmptyLinesToKeep`:设置最多保留的空行数量,取值范围为正整数。
11. `PointerAlignment`:设置指针类型对齐方式,取值范围为`Right``Left``Center`12. `SortIncludes`:设置是否对include指令进行排序,取值范围为`true``false`13. `SpaceBeforeAssignmentOperators`:设置是否在赋值运算符前添加空格,取值范围为`true``false`14. `SpacesBeforeTrailingComments`:设置注释符前边的空格数量,取值范围为正整数。
15. `SpacesInCStyleCastParentheses`:设置是否在C风格转换Parentheses中使用空格,取值范围为`true``false`16. `SpaceInEmptyParentheses`:设置是否在空元组对中添加空格,取值范围为`true``false`17. `SpacesInParentheses`:设置是否在元组对中添加空格,取值范围为`true``false`18. `SpacesInSquareBrackets`:设置是否在方括号中添加空格,取值范围为`true``false`19. `UseTab`:设置是否使用制表符(tab)而不是空格进行缩进,取值范围为`Never``WithinProject``Always"。

  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值