Search code examples
c++visual-studioreformat

Free tools that automatically reformat whole C/C++ source files in VS2008 on save?


I'm looking for a tool (macro, extension) for Visual Studio 2008 that would reformat the source code (C/C++) when you save the file.


Solution

  • AStyle was my first hit on Google. Looks reasonable. You can tie that to a keyboard event under 'External Tools' in Visual Studio. (I suspect writing/recording a small macro that formats and saves the file is easy, as is rebinding that to Ctrl-S)

    See also https://stackoverflow.com/questions/841075/best-c-code-formatter-beautifier, which also recommends AStyle.