Search code examples
c++code-formattingcode-readability

Is there any tool to standardize format of C++ code?


I'm looking for a tool that works on Windows to reformat some C++ code in my codebase. Essentially, I've got some code I wrote a while ago that I'd like to use, but it doesn't match the style I'm using in a more recent project.

What's the best way to reformat C++ code in a standard manner?

Billy3


Solution

  • In Visual Studio: Edit / Advanced / Format Document

    The format applied to the document will match the settings in: Tools / Options / Text Editor / C/C++

    Visual Studio might not support all the formatting options you want applied to your document, in which case you'll need a separate tool (such as Paul Betts is suggesting) to format the way you want.