Artistic style for use under Windows (C + +)

Source: Internet
Author: User
Tags case statement switch case

Artisticstyle is an open source source code formatting tool. The home address is: http://astyle.sourceforge.net/, which can be applied in C, C + +, objective-c, C #, Java and other programming languages. A detailed introduction to using it in http://astyle.sourceforge.net/astyle.html.

Download Astyle_2.05.1_windows.zip from http://sourceforge.net/projects/astyle/files/under Windows, and after extracting it, it will astyle/bin/ Under the AStyle.exe copy to the C:\WINDOWS directory, so that you do not have to specify the path.

Open the CMD command prompt and locate it in the. C,. cpp,. h,. HPP directory and execute: AStyle.exe1.cpp.

Common Options Parameter Description:

1.-S4: Indicates indent 4 spaces, default configuration;

2.-S: Indicates the indentation of the case statement in switch;

3.-N: Indicates indentation within the namespace namespace;

4.-U: Indicates that there are no spaces between the arguments of the two ends in parentheses and the parentheses;

5.-H: Adds a space to the right of the keyword "if", "for", "while", and so on;

6.-K1: * and &, when representing pointers and reference types, and type names are tight, and variable names are left blank;

7.-P: Add a space around the operator symbol (operator);

8.-P: Insert a space on either side of the parenthesis;-D only inserts a space outside the brackets, and-D inserts only inside;

9.-j: Add braces to each "if", "for", "while";

-D: Add a space on the side of the parenthesis;

One.-C: Replace tab with a space;

-M: Aligning the defined parameters and variables;

-W: alignment of the macro;

--style=ansi:ansi standard file format, the "{", "}" to start another line;

--indent=spaces=4: Indentation using 4 spaces;

--add-brackets: Add parentheses to statements for "if", "for", "while" lines;

--convert-tabs: Cast tab is a space;

--indent-preprocessor: The predefined statements such as preprocessor (#define), if there are multiple rows before the padding alignment (is to fill a single statement multiline);

--align-pointer=type: *, & characters close to the type;

--align-pointer=name: *, & this type of character is close to the variable name;

--pad-oper: Add a space character on both sides of the operation symbol;

--pad--header: Add a space after the keyword "if", "for", "while", etc.

The code for the--indent-switches:switch case is also indented in the standard indent mode;

--indent-col1-comments: If the first line after the function starts (after "{") is a comment, it is also indented;

--indent=tab: Display instructions using Tab;

Reference: http://www.cnblogs.com/goed/archive/2013/12/17/3478972.html

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Artistic style for use under Windows (C + +)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.