格式化代码

首选 Clang-Format

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#

 

Astyle

http://astyle.sourceforge.net/

http://astyle.sourceforge.net/astyle.html

 

批量格式化

bash命令如下:

for f in $(find . -name '*.c' -or -name '*.cpp' -type f); do astyle --style=kr $f; done

 

即如下bash脚本:

 

#! /bin/bash

for f in $(find . -name '*.c' -or -name '*.cpp' -type f)
do
astyle --style=kr $f
done

 

posted @ 2019-12-25 19:16  sinferwu  阅读(263)  评论(0编辑  收藏  举报