Oh god, so many hideous code styles. The only one remotely passable is
>>31, and it has the legacy compatibility limitations of old K&R, such as requiring the open brace of a function on a newline.
>>29 actually isn't terrible, except for the fact that his spacebar seems to be broken.
As the author of
>>60, I feel I must educate furthur as to the one true style. There's lots of stuff this did not cover:
double braces around assignment in if statements
if ((x = 7)) do_some_shit();
related declarations should have equal signs aligned
int something = 4;
int something_else = 7;
repeated related function calls should have arguments aligned (with space only after the commas, none trailing; no alignment of commas or closing brace)
some_func(an_arg, another_arg);
some_func(a_third_arg, last_arg);
braces can be used around and in ternary operator when needed, and put spaces around ? and : (but never inside braces). usually put braces around arms when needed to clarify, even when the precedence order would allow no braces (mainly because the inner arm of ?: breaks the precedence order)
some_func(a ? (b + c) : d, e);
if an else block needs braces, add braces for the if block as well (don't do like OP). they don't add any lines in this case.
if (x % 2 == 0) {
printf ("%d\n", x);
} else {
printf("%c\n", c);
c = c + 1;
}
no line length limits; this isn't the stone ages. but be reasonable. repeated related function calls however can break the 'reasonable' limitation, and run well over 200 characters; scrolling horizontally to see a table of well-aligned function calls is much preferable to 30 lines of repeated function calls with no alignment to show you the argument layout.