c++coding-stylecode-formattingastyle

What option should be used to remove extra spaces using astyle?


How can I remove extra spaces from my code using astyle? For example I want to convert the following code:

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

to this:

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

But astyle is currently converting it to this:

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

Solution

  • --squeeze-ws can do this job finally (astyle v3.3+)

    https://astyle.sourceforge.net/astyle.html#_squeeze-ws