Simetrical schreef:
On Tue, Apr 15, 2008 at 9:51 AM, Roan Kattouw roan.kattouw@home.nl wrote:
It should be noted that brace and parenthesis styles are somewhat mixed in the MW code (especially in the API), but those are minor differences such as not putting an extra space after a ( or putting a { on a separate line.
The "official" brace style, as stated in docs/design.txt, in K&R: opening braces go on the same line. This is followed pretty carefully throughout the entire core code base:
aryeh@aryeh-desktop:/var/www/trunk/phase3$ find -iregex '^.*.(php|inc)$' -exec grep '^\s*{' {} + | grep -v languages/messages | wc -l 510 aryeh@aryeh-desktop:/var/www/trunk/phase3$ find -iregex '^.*.(php|inc)$' -exec grep '^.*[^\s].*{' {} + | grep -v languages/messages | wc -l 22440
Hmm, it appears brace style is (inadvertently) very well-observed in the API, even though I generally put the opening brace on a separate line: $ grep '^\s*{' *.php | wc -l 1 $ grep '^.*[^\s].*{' *.php | wc -l 1549
Parenthesis style is significantly different, though (the second is my preferred style, the third was Yuri's) $ grep '(if|while|for|foreach) ( ' *.php | wc -l 17 $ grep '(if|while|for|foreach)([^ ]' *.php | wc -l 397 $ grep '(if|while|for|foreach) ([^ ]' *.php | wc -l 635 $ grep '(if|while|for|foreach)( ' *.php | wc -l 43
Roan Kattouw (Catrope)