Thursday, November 8, 2007

Curly-brace wrangling

This is not new, but neither is C:

http://www.chris-lott.org/resources/cstyle/witters_tao_coding.html

I'm investigating coding style, and this is the best style I've seen so far -- at least for C, C++ and Javascript -- which appear to be the two languages most susceptible to oddly formatted code, anyway. I flailed against the extra space inside parens for a little while, but now I see the wisdom of it (for C and C++, since parens should sting a little there). Combining Witter's style and typedefs for function pointers, and I think I'm set for inflicting well-informed pedantry on any new code that comes under my gaze.

The two other sources on programming style/zen that impressed me are also referenced here: the style guide for the Linux kernel is short and sweet, and Fred Brooks' "No Silver Bullet" is, like, important. Rob Pike's article is also interesting, especially at the end. There's a lot of cross-referencing between all of these and the Wikipedia entry on Unix philosophy.