If you have that much nesting, I would argue your code needs to be refactored. All block level constructs within a function can themselves be made functions and removed from their original locality. This doesn't necessarily have to reduce readability and frequently can improve it. I am of the *general* opinion that if the method cannot fit onto a single page, then refactoring it is probably in order. <div>
<br></div><div>Move switch cases to their own methods. Sets of logically-related nested if's can be moved to their own cases as well (for the same reasons.) Usually the work of a method is done in its leaf blocks, not in the setup which selects the appropriate leaf and it's often fair to consider them separately. With good editing tools (which all of us have access to) there is almost no cost to having the code split up either. Maybe when everyone was using edlin massive nested functions were acceptable - even necessary - but this is the 21st century. Use the equivalent of 'Go To Definition' or open up another view of your code to see the implementation at the same time.</div>
<div><br></div><div>As for the difference between 80 and 120, I don't really care. I would be more concerned actually about the reasons we are reaching that limit, particularly if it's due to excessive nesting.</div>
<div><br></div><div>- Cliff <div><br><div class="gmail_quote">On Sun, Apr 10, 2011 at 10:04 AM, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> 80 characters. Not a phobos contributor, but I've been coding for 20 years<br>
> in various languages. Long lines are hard to read - almost invariable<br>
> nasty compound expressions (which should be factored for readability) or<br>
> extremely long identifier names (nothing wrong with this, but ids should<br>
> be as long as necessary and no longer. There is no benefit to putting so<br>
> much stuff onto a single line.<br>
><br>
> If you don't like coding style rules, tough - welcome to the real world.<br>
> Until we write an IDE that operates on ASTs and formats code on an<br>
> individual basis, we will continue to have to do these things.<br>
><br>
> P.S. As a general rule, maintain the formatting style of the file in which<br>
> you are making edits (spacing, bracing, etc.)<br>
<br>
</div>I confess that I've never understood why anyone would think that 80 characters<br>
was enough. And almost everyone that I've ever discussed it with prior to it<br>
coming up on the newsgroups here has thought that an 80 character limit was<br>
outdated and constraining, so to find folks here thinking that 80 characters<br>
is a good limit is very odd. It's just too short.<br>
<br>
The main problem is indenting. If no code were indented, then 80 characters<br>
wouldn't be so bad. But when you indent much at all (especially with 4<br>
characters per level of indentation), 80 characters very quickly becomes too<br>
short. And if you have appropriately descriptive symbol names, then you're<br>
doubly screwed.<br>
<br>
So, while a character limit may make sense, I don't understand how anyone<br>
could be happy with only 80 characters. Sure, there are plenty of lines of<br>
code that will fit within 80 characters, but it doesn't take much at all<br>
before they don't - particularly with 4 characters per level of indentation<br>
and properly descriptive variable names. 80 is just too restrictive. 80<br>
characters after the indentation wouldn't generally be a problem, but when it<br>
includes the indentation, it's definitely a problem.<br>
<font color="#888888"><br>
- Jonathan M Davis<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
phobos mailing list<br>
<a href="mailto:phobos@puremagic.com">phobos@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/phobos" target="_blank">http://lists.puremagic.com/mailman/listinfo/phobos</a><br>
</div></div></blockquote></div><br></div></div>