mywiki:linux:linux_soding_style
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mywiki:linux:linux_soding_style [2014/10/22 22:02] – shaoguoh | mywiki:linux:linux_soding_style [2022/04/02 17:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 173: | Line 173: | ||
| ===== Astyle ===== | ===== Astyle ===== | ||
| + | astyle special usage based on V2.0.4 http:// | ||
| + | Example: | ||
| + | astyle --options=none --align-pointer=name --pad=oper --unpad-paren --pad-paren-out --trim-trailing-whitespace | ||
| + | |||
| + | --options=none | ||
| + | Disable the default options file. Only the command-line | ||
| + | | ||
| + | -p, --pad=oper | ||
| + | Insert space padding around operators | ||
| + | |||
| + | -U, --unpad-paren | ||
| + | Remove space padding around parenthesis on the inside | ||
| + | side. Can be used in combination with the paren padding options. | ||
| + | Only padding that has not been requested by other options | ||
| + | be removed. | ||
| + | |||
| + | -d, --pad-paren-out | ||
| + | Insert space paddings around parenthesies on the outside | ||
| + | This can be used with unpad=paren to remove unwanted spaces. | ||
| + | | ||
| + | With -U -d two options, it will be like if (k > 0), not if( k > 0 ) | ||
| + | |||
| + | -k3, --align-pointer=name | ||
| + | Attach a pointer or reference operator (*, &, or ^) to the variable name (right). | ||
| + | for example: **char* p** becomes **char *p** | ||
| + | |||
| + | ===== Perl/Bash ===== | ||
| + | Use perl to remove trailing whitespace in a string: | ||
| + | $str =~ s/\s+$//; | ||
| + | Take 1 or more white spaces (\s+) till the end of the string ($), and replace them with an empty string. | ||
mywiki/linux/linux_soding_style.1413986570.txt.gz · Last modified: (external edit)
