Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a C++ code prettifier that will remove empty lines

I've just taken over a large, poorly formatted mass of C++ code. I'm looking for a code prettifier with two specific features.

  • Remove superfluous access modifiers

  • Clean up white space in a nice way. eg. leave blank lines between functions, collapse multiple blank lines into one within functions, remove blank lines between the opening/closing brace of a function and the start/end of the code.

This is a typical example. I don't want to have to write one, it'd take too long to prove that it couldn't damage the code and there's way too much to check by eye.

class CLASS_DECL_BASE OComStorage : public OBase
{
  private:

  protected:

  public:


      OComStorage (void );




      ~OComStorage (void );

      void Thanks_Guys();
like image 379
Spike Avatar asked Oct 12 '22 08:10

Spike


1 Answers

See artistic style. I've used it on a medium-sized code-base without creating any problems. It can do a variety of source transforms on whitespace, indentation and so on.

Just make sure you back up your code (source control) while you experiment with the many, many options. The defaults are somewhat surprising...

like image 92
André Caron Avatar answered Nov 02 '22 10:11

André Caron