如何使用astyle格式化C方法中的开括号?

将函数的左大括号移动到下一行是一种常见的做法.
如何在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.

相关文章

一.C语言中的static关键字 在C语言中,static可以用来修饰局...
浅谈C/C++中的指针和数组(二) 前面已经讨论了指针...
浅谈C/C++中的指针和数组(一)指针是C/C++...
从两个例子分析C语言的声明 在读《C专家编程》一书的第三章时...
C语言文件操作解析(一)在讨论C语言文件操作之前,先了解一下...
C语言文件操作解析(三) 在前面已经讨论了文件打开操作,下面...