On 9/20/12, Gabriel Dos Reis <g...@integrable-solutions.net> wrote: > On Sep 20, 2012 Lawrence Crowl <cr...@googlers.com> wrote: > > > > Why do you think cascading ifs is a bad idea? > > > > > > Precedent. Confusion in case of dangling else (requiring > > > more {}, and hence even more indentation). Ugly. > > > > I generally take ugly as an indication that the function needs > > refactoring. > > Hear! Hear! Hear! > > Sadly, many functions in GCC (at least in cp/) are in that > category :-(
It is not just GCC. Most large codebases I've seen have had lots of large functions. It takes persistent effort to beat back entropy. I once chatted with a guy who worked on a project with a strict requirement that every function fit on one screen, and that was when screens were 24 lines. He said their bug rate was really low. And the one function they made an exception for turned out the have the worst bug in it. -- Lawrence Crowl