Clang-format格式标准化

1,工具与准备:

VS code中可以安装clang-format扩展或者使用C/C++;

   

2,配置VS code

设置中,首选项->设置; 可使用everythin搜索clang-format.exe; 一般visual studio会自带,选择一个即可(在环境变量中,添加对应的路径);

   

   

3,配置 .clang-format

中断使用以下命令创建 .clang-format文件(内容编码为UTF8或UTF8 BOM),否则容易报错

clang-format-style=llvm -dump-config> .clang-format

   

建议配置

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

BasedOnStyle: LLVM

ColumnLimit: 120

IndentWidth: 4

TabWidth: 4

UseTab: Never

SpaceBeforeParens: ControlStatements

SpaceBeforeAssignmentOperators: true

SpaceAfterTemplateKeyword: true

SpaceAfterCStyleCast: true

SpaceBeforeCStyleCastParentheses: true

SpacesAroundRangeBasedForLoopColon: true

SpaceBeforeRangeBasedForLoopParentheses: false

SpacesInContainerLiterals: true

BreakStringLiterals: true

BreakBeforeBraces: Linux

   

posted @   理想是书店店长  阅读(93)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具

喜欢请打赏

扫描二维码打赏

了解更多

点击右上角即可分享
微信分享提示