Using indent to organize code under Linux

Source: Internet
Author: User
Tags case statement function definition

Indent is the next most powerful code-finishing software in Linux, which makes it easy to write code with very good style. To view the/usr/src/linux-headers-< version >/scripts/lindent file, you can see a line of code:

Indent-npro-kr-i8-ts8-sob-l80-ss-ncs-cp1

This line is the format of the Linux kernel using indent to organize the code, using this command to achieve a very good style of C or C + + code. Where-l80 is a maximum of 80 letters per line, beyond the line will be split, if you do not like can use longer line words.

The value of the indent parameter used means:
--blank-lines-after-declarations bad variable declaration after blank line
--blank-lines-after-procedures bap function ends with empty lines
--blank-lines-before-block-comments BBB block comment before blank line
--break-before-boolean-operator Bbo long lines, in front of logical operators branch
--blank-lines-after-commas NBC variable declaration, comma-delimited variables do not branch
--braces-after-if-line bl "If" and "{" Divide two lines
--brace-indent 0 bli0 "{" does not continue indenting
--braces-after-struct-decl-line BLS definition structure, "struct" and "{" Branch
--comment-indentationn C33 statement after comment starts at line 33
--DECLARATION-COMMENT-COLUMNN cd33 Variable declaration after comment starts at line 33
--comment-delimiters-on-blank-lines NCDB does not change a single-line comment to a block comment
--cuddle-do-while NCDW "Does---while" and "}" on the previous line
--cuddle-else nce "Else" and its preceding "}" to another line
--case-indentation 0 0 Spaces in case statement in Cli0 switch
--else-endif-columnn cp33 #else, #endif后面的注释开始于行33
--space-after-cast CS Add a space after type conversion
--line-comments-indentation n D0 Single-line comment (does not start with 1 columns), does not indent to the left
--break-function-decl-args NBFDA Close: A row of parameters for a function
--declaration-indentationn Di2 Variable declaration, the variable starts at 2 rows, i.e. does not have to be aligned
--format-first-column-comments NFC1 do not format comments from the first line
--format-all-comments NFCA do not turn on all formatted comments switch
--honour-newlines HNL Prefer to broke long lines at the position of newlines in the input.
--indent-leveln I4 sets how many characters to indent, and if it is an integer multiple of tab, it is indented with a tab, otherwise filled with spaces.
--parameter-indentationn IP5 an old style function definition in parameter description indent 5 spaces
--line-length l75 Non-commented line maximum 75
--continue-at-parentheses LP continuation line starts with the parentheses that appear on the previous line
--space-after-procedure-calls the PCS function and "(" insert a space between
--space-after-parentheses Nprs do not insert spaces before "(") "
--procnames-start-lines PSL places the function name and return type in two lines of definition
--space-after-for SAF for followed by a space
--space-after-if sai If there are spaces behind
--space-after-while saw while there are spaces behind
--start-left-side-of-comments NSC does not add * in generated block comments
--swallow-optional-blank-lines nsob do not remove empty lines that can be added
--space-special-semicolon NSS line for or while statement, in the ";" Before it is empty.
--tab-size ts4 a tab is 4 spaces (to be divisible by "-in")
--use-tabs ut using tab to indent

Using indent to organize code under Linux

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.