将函数的左大括号移动到下一行是一种常见的做法.
如何在astyle(代码美化)的类方法中应用它?
如何在astyle(代码美化)的类方法中应用它?
例:
// this is an initial C++ code class Class { public: static int foo(bool x) { if (x) { return 42; } else { return 0; } } };
修改后的版本应该是:
class Class { public: static int foo(bool x) { // this brace in next line if (x) { return 42; } else { return 0; } } };
我的所有尝试都只适用于全局功能.
解决方法
–style = kr / -A3和–style = linux / -A8选项也应该适用于类方法.
来自文档:
Brackets are broken from namespace,class,and function definitions. Brackets are attached to statements within a function.