Quote:Original post by kordova
Personally, to compensate I alter my code such that it never extends beyond the 78th character column. In the event that it has to, I will comment the closing brace to indicate its parent.
Hmm, I explicitly forbid that in my conventions - the reason being that if a code block is big enough to not fit neatly onscreen, then it's too big and should be broken up. So, adding the comment is patching the problem, not fixing it.
As a general rule, I believe that functions should fit on about a screenful of code. Anything larger tends to be unwieldy, and is also usually trying to do more than one thing, which is a bad idea. Anyone who really believes that they need more vertical space needs to either a) upgrade from a 13" monitor or b) focus on writing smaller, more focused functions.
As for the whole 80-column thing with conditionals, my convention calls for the following:
if( foo&& bar&& ( baz || blah )){ // No beer and no TV make Homer something something}
for conditionals that are too hairy to break apart into smaller components. This style is also applicable to functions that take parameters with big names, like this (except with tabs stops at 4 characters):
wxSlider *slider = new wxSlider ( window, wxID_ANY, mValue, 0, 20, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS | wxSL_TOP );
I really like it, as it matches the general style of the rest of the code, and it certainly makes complicated conditionals easier to read. People that have come and worked for me frequently dislike it at first, and then really like it after a little bit.