C++ 使用astyle删除额外空格时应使用什么选项?

C++ 使用astyle删除额外空格时应使用什么选项?,c++,formatting,coding-style,code-formatting,astyle,C++,Formatting,Coding Style,Code Formatting,Astyle,如何使用astyle从代码中删除额外的空格?例如,我想转换以下代码: void foo ( int a , int c ) { d = a+ c; } 为此: void foo (int a, int c) { d = a + c; } 但astyle目前正在将其转换为: void foo (int a , int c) { d = a + c; } 目前无法在astyle中取消放置运算符周围的空格。如果有办法解开操作

如何使用
astyle
从代码中删除额外的空格?例如,我想转换以下代码:

void foo (     int  a  ,  int   c )
{
d   = a+      c;
}
为此:

void foo (int a, int c)
{
    d = a + c;
}
但astyle目前正在将其转换为:

void foo (int  a  ,  int   c)
{
    d   = a +      c;
}

目前无法在astyle中取消放置运算符周围的空格。如果有办法解开操作员的标签, 您可以先取消添加空格,然后使用-p选项再次填充空格

--pad oper/-p

在运算符周围插入空格填充

如有可能,任何行尾注释将保留在原始列中

请注意,没有取消粘贴的选项。一旦填充,它们就保持填充状态

变成:

来源:

您可以使用
--pad header/-H
取消加载

参考:

if (foo==2)
    a=bar((b-c)*a,d--);
if (foo == 2)
    a = bar((b - c) * a, d--);