User Tools

Site Tools


mywiki:linux:linux_soding_style

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mywiki:linux:linux_soding_style [2014/10/22 22:02] shaoguohmywiki: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://astyle.sourceforge.net/astyle.html
  
 +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  parameters will be used.
 +  
 +-p, --pad=oper   
 +    Insert space padding around operators  only. for example: i-j becomes i - j
 +
 +-U, --unpad-paren
 +    Remove space padding around parenthesis on the inside  and  out‐
 +    side. Can be used in combination with the paren padding options.
 +    Only padding that has not been requested by other  options  will
 +    be removed.
 +
 +-d, --pad-paren-out  
 +      Insert space paddings around parenthesies on the  outside  only.
 +      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)