标签: astyle

如何用"艺术风格""破解"C代码

使用Artistic Style代码格式化程序,我如何实现相反的目标--break-after-logical / -xL,如果我有......

if (thisVariable1 == thatVariable1
        || thisVariable2 == thatVariable2
        || thisVariable3 == thatVariable3)
    ...
Run Code Online (Sandbox Code Playgroud)

......我明白了......

if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3)
    ...
Run Code Online (Sandbox Code Playgroud)

c formatting astyle

10
推荐指数
1
解决办法
512
查看次数

如何使用 astyle 在 C++ 方法中格式化左大括号?

将函数的左大括号移到下一行是一种常见做法。如何使用 astyle(代码美化器)在类方法中应用它?

例子:

// this is an initial C++ code
class Class
{
public:
    static int foo(bool x) {
        if (x) {
            return 42;
        } else {
            return 0;
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

修改后的版本应该是:

class Class
{
public:
    static int foo(bool x)
    { // this brace in next line
        if (x) {
            return 42;
        } else {
            return 0;
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

我所有的尝试都只适用于全局函数。

c++ astyle

5
推荐指数
1
解决办法
1285
查看次数

Dev-C++ IDE 中的自动格式化功能

在 Eclipse 中,我总是使用Ctrl + shift + fIDE 中的自动格式化代码。

Dev-C++中是否有类似的功能,或者是否有一些可用于格式化我的 C/C++ 代码的插件?

c++ windows ide dev-c++ astyle

5
推荐指数
1
解决办法
4万
查看次数

astyle:使用“--exclude”选项排除文件和目录时出现问题

我最近遇到了 astyle 的使用问题,我一直无法弄清楚。我不确定这是否是一个错误,或者我只是错误地使用了 astyle 工具。我尝试使用“--exclude”选项来忽略处理中的文件和目录,但继续收到“不匹配的”排除错误并且 astyle 终止:

bwallace$ ls -l foo.c
-rw-r--r-- 1 bwallace 1767304860 22 Aug 1 21:36 foo.c

bwallace$ astyle ./foo.c --exclude=./foo.c -v
Artistic Style 2.04 08/03/2014
Exclude (unmatched) ./foo.c
Artistic Style has terminated
Run Code Online (Sandbox Code Playgroud)

当我传递“-i”(忽略排除错误)时,astyle 按预期处理文件。因此,“排除”语句似乎有问题。

bwallace$ astyle ./foo.c --exclude=./foo.c -v -i
Artistic Style 2.04 08/03/2014
Exclude (unmatched) ./foo.c
Unchanged ./foo.c
0 formatted 1 unchanged 0.00 seconds 2 lines
Run Code Online (Sandbox Code Playgroud)

这是一个错误吗?我是否错误地使用了 astyle?任何帮助,将不胜感激。

astyle

5
推荐指数
1
解决办法
2162
查看次数

应该使用什么选项来使用 astyle 删除多余的空格?

如何使用 删除代码中的多余空格astyle?例如我想转换以下代码:

void foo (     int  a  ,  int   c )
{
d   = a+      c;
}
Run Code Online (Sandbox Code Playgroud)

对此:

void foo (int a, int c)
{
    d = a + c;
}
Run Code Online (Sandbox Code Playgroud)

但是 astyle 目前正在将其转换为:

void foo (int  a  ,  int   c)
{
    d   = a +      c;
}
Run Code Online (Sandbox Code Playgroud)

c++ formatting coding-style code-formatting astyle

5
推荐指数
1
解决办法
1266
查看次数

我可以列出使用astyle格式化的文件吗?

astyle是否具有会执行以下操作的选项:

"For the given list of files, list the files that *would be* modified by astyle."
Run Code Online (Sandbox Code Playgroud)

因此,基本上列出不符合astyle的文件,但实际上不要更改它们。我浏览了手册页,找不到任何有用的信息。astyle创建.orig文件,我可以使用该信息,但是我宁愿不要使驱动器混乱,即使astyle可以在事后进行清除。我真的很想这样的选择。

c c++ coding-style astyle

3
推荐指数
1
解决办法
296
查看次数

样式化文件夹中所有文档的格式,并且不创建备份文件

我刚开始使用astyle。

  1. 是否可以对文件夹中的所有文件运行样式?
  2. 如果文件夹中包含不同格式的文件,是否可以明智地选择仅C / C ++文件进行格式化?
  3. 是否可以将astyle链接到gedit,以便从现在开始编写的程序采用格式?
  4. 格式化后是否可能不创建file.cpp.orig备份文件?

谢谢!

astyle

2
推荐指数
1
解决办法
1510
查看次数

标签 统计

astyle ×7

c++ ×4

c ×2

coding-style ×2

formatting ×2

code-formatting ×1

dev-c++ ×1

ide ×1

windows ×1