通过indent参数分析,比较自定义风格和GNU,KR,BSD编程风格。
表 A.1. 自定义风格和GNU,KR,BSD风格比较
| 参数 | 含义 | 我们的风格 | GNU风格 | KR风格 | BSD风格 |
|---|---|---|---|---|---|
| -bad | --blank-lines-after-declarations | y | n | n | n |
| -bap | --blank-lines-after-procedures | y | y | y | n |
| -bbb | --blank-lines-before-block-comments | y | |||
| -bbo | --break-before-boolean-operator | y | y | y | y |
| -bc | --blank-lines-after-commas | n | n | n | y |
| -bl | --braces-after-if-line | y | y | ||
| -blin | --brace-indent n | 0 | 2 | ||
| -bls | --braces-after-struct-decl-line | y | y | ||
| -br | --braces-on-if-line | y | y | ||
| -brs | --braces-on-struct-decl-line | y | y | ||
| -bs | --blank-before-sizeof | ||||
| -cn | --comment-indentationn | 33 | 33 | 33 | |
| -cbin | --case-brace-indentationn | ||||
| -cdn | --declaration-comment-columnn | 33 | 33 | 33 | |
| -cdb | --comment-delimiters-on-blank-lines | n | n | n | y |
| -cdw | --cuddle-do-while | ||||
| -ce | --cuddle-else | n | n | n | y |
| -cin | --continuation-indentationn | 4 | 4 | ||
| -clin | --case-indentationn | 0 | 0 | 0 | |
| -cpn | --else-endif-columnn | 33 | 1 | 33 | 33 |
| -cs | --space-after-cast | y | y | y | |
| -dn | --line-comments-indentationn | 0 | 0 | ||
| -ndj | indents declarations the same as code | y | |||
| -bfda | --break-function-decl-args | n | |||
| -din | --declaration-indentationn | 2 | 2 | 1 | 16 |
| -fc1 | --format-first-column-comments | n | n | n | y |
| -fca | --format-all-comments | n | n | n | y |
| -gnu | --gnu-style | ||||
| -hnl | --honour-newlines | y | y | y | y |
| -in | --indent-leveln | 4 | 2 | 4 | 4 |
| -ipn | --parameter-indentationn | 5 | 5 | 0 | 4 |
| -kr | --k-and-r-style | ||||
| -ln | --line-lengthn | 75 | 75 | 75 | |
| -cs | --space-after-cast | ||||
| -dn | --line-comments-indentationn | ||||
| -bfda | --break-function-decl-args | ||||
| -din | --declaration-indentationn | ||||
| -fc1 | --format-first-column-comments | ||||
| -fca | --format-all-comments | ||||
| -gnu | --gnu-style | ||||
| -hnl | --honour-newlines | ||||
| -in | --indent-leveln | ||||
| -ipn | --parameter-indentationn | ||||
| -kr | --k-and-r-style | ||||
| -ln | --line-lengthn | ||||
| -lcn | --comment-line-lengthn | ||||
| -lp | --continue-at-parentheses | y | y | y | |
| -lps | --leave-preprocessor-space | ||||
| -orig | --original | ||||
| -npro | --ignore-profile | ||||
| -pcs | --space-after-procedure-calls | y | y | n | n |
| -pin | --paren-indentationn | ||||
| -pmt | --preserve-mtime | ||||
| -prs | --space-after-parentheses | n | n | n | n |
| -psl | --procnames-start-lines | y | y | n | y |
| -saf | --space-after-for | y | y | y | y |
| -sai | --space-after-if | y | y | y | y |
| -saw | --space-after-while | y | y | y | y |
| -sbin | --struct-brace-indentationn | ||||
| -sc | --start-left-side-of-comments | n | n | n | y |
| -sob | --swallow-optional-blank-lines | n | n | n | n |
| -ss | --space-special-semicolon | n | n | n | |
| -st | --standard-output | ||||
| -T typenames | Tell indent the name of typenames. | ||||
| -tsn | --tab-sizen | 4 | 8 | ||
| -ut | --use-tabs | y | |||
| -v | --verbose | ||||
| -version | Output the version number of indent. |
$Date$
Copyright © 2006 WorldHello 开放文档之源 计划 |