astyle code formatter

Test environment vs2012

1. Purpose

  As a programmer, the importance of code specification is unquestionable. At all times, keep standard code rules in mind. It's not easy to stick to yourself. But in many cases, it is necessary to modify other people's code, such as modifying other people's bugs. The code style of others may be different from your own. At this time, you should try to respect and follow the style of others, so that the code style of the project is consistent. But if someone else's code does have many places that do not conform to public norms, it will be cumbersome to modify by hand. Therefore, it is necessary to introduce third-party tools to beautify the code style of parts, entire files, and even multiple files. After searching on the Internet, there are two suitable for VS C++: AStyle and CoolFormat. The following introduces astyle.


2. Download the astyle tool and source code

  Download address: http://download.csdn.net/detail/u012654882/9807489


3. Installation process

  1) Put the execution package in the astyle tool in the IDE directory of vs C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

  As shown in the figure:

                   

  2) Open vs2012 Tools -> External Tools -> Add

    The parameters are set to: --style=ansi $(ItemFileName)$(ItemExt)

    As shown in the figure:

                                 

  3) Modify the code style (only modify the format of a single file of the current file)

    Click: Tools -> astyle

    As shown in the figure:

                     

  So far, the nginx code style has been modified to ansi style.

Reference documentation:

http://blog.csdn.net/lhb_0531/article/details/8571395


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325763143&siteId=291194637