是將函數的開括號到下一行的通常做法。 如何在課堂上使用的方法的astyle(代碼美化)應用此?如何使用astyle在C++方法中設置開頭花括號?
例如:
// 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;
}
}
};
我所有的努力只有在全局函數工作。
這可能與此問題有關:http://sourceforge.net/tracker/index.php?func=detail&aid=3259702&group_id=2319&atid=102319 – DRH 2012-04-06 17:07:23