clang-format 在函数声明中添加不一致的换行符
clang-format add inconsistent line break in function declaration
我喜欢在 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++ 核心准则。尽管如此,该遗留代码的格式应保持一致。
AlignAfterOpenBracket: DontAlign
正在执行所需的行为。
我喜欢在 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++ 核心准则。尽管如此,该遗留代码的格式应保持一致。
AlignAfterOpenBracket: DontAlign
正在执行所需的行为。