我喜欢在C / C ++的大型代码库上使用clang-format。
我不明白为什么clang-format有时会给我这种不一致的格式
virtual void someReallyLongFunctionName(
float* aaaaa, float* aaaaaaaaaaaaa, float* bbbbb, float* bbbbb, float* bbbbbbb, int* ccccc, int* cccccc,
int* ccccc, float* cccccccc, float* cccccccc, float* ccccccc, float* ccccccccc, float* cccccc, float* ccccccccc,
float* ccccccccccc, float* c, float* ccc, float* ccccc, float* ccccc, int* cccc, float* dddddddddddddddddddddd,
float* ddddd, float* dddd, float* ffffffffffff, int* fffffff, float* fffffff, float* ffffffffffffffffffffff,
int* ffffff, int* fffff, int* fffffffffffffff, int ffsddffffffffff, float* aaaaaaaaaaaaaaaa,
float* aaaaaaaaaaaa, int* aaaaaaaaaaaa, logical* aaaaa, float* bbbbbbbbb) const = 0;
virtual void shortName(float* aaaaa, float* aaaaaaaaaaaaa, float* bbbbb, float* bbbbb, float* bbbbbbb, int* ccccc,
int* cccccc, int* ccccc, float* cccccccc, float* cccccccc, float* ccccccc, float* ccccccccc,
float* cccccc, float* ccccccccc, float* ccccccccccc, float* c, float* ccc, float* ccccc,
float* ccccc, int* cccc, float* dddddddddddddddddddddd, float* ddddd, float* dddd,
float* ffffffffffff, int* fffffff, float* fffffff, float* ffffffffffffffffffffff,
int* ffffff, int* fffff, int* fffffffffffffff, int ffsddffffffffff, float* aaaaaaaaaaaaaaaa,
float* aaaaaaaaaaaa, int* aaaaaaaaaaaa, logical* aaaaa, float* bbbbbbbbb) const = 0
我使用了clang-format -style="{BasedOnStyle: Google, ColumnLimit: 120, IndentWidth: 4}"
,版本4.0.0。
我可以使用哪个开关或惩罚值来强制someReallyLongFunctionName
看起来像这样
virtual void someReallyLongFunctionName(float* aaaaa, float* aaaaaaaaaaaaa, ...
并没有引入额外的换行符。
我知道界面违反了c ++核心指南。然而,这些遗留代码应该一致地格式化。
答案 0 :(得分:0)
AlignAfterOpenBracket: DontAlign
正在执行所需的行为。