News for hackers. Stuff that matters.
Re:Tom Duff: Reading Code From Top to Bottom (1999) by brnstz on Saturday June 04, 2011 @10:49PM (#2621152)
It was part of the structured programming dogma. One entry point, one exit point. Multiple return was lumped in with using goto.

I never use goto, but I often use multiple returns similar to the examples in this article.

I have sadly code reviewed many pieces of code with the nesting problem.

Re:Tom Duff: Reading Code From Top to Bottom (1999) by malkia on Saturday June 04, 2011 @11:44PM (#2621228)
if you have to use C++ without exceptions (console video games), then goto is much needed to handle exceptional situations locally. For example there would be label "fail:;" or "out:;" at the end of the function, where release of resource would happen, and you would "goto" to it, rather than releasing the resources in multiple exceptional places and return from there.
Re:Tom Duff: Reading Code From Top to Bottom (1999) by brnstz on Sunday June 05, 2011 @12:01AM (#2621266)
Interesting. I rarely program in an environment without exceptions, so I haven't had reason to adopt that style.

I recall that Linus has advocated the use of goto in the Linux kernel for similar reasons. And the goto version of this code does seem more readable to me: http://kerneltrap.org/node/553/2131

Re:Tom Duff: Reading Code From Top to Bottom (1999) by cpeterso on Sunday June 05, 2011 @01:24AM (#2621385)
If you are using C++ (even without exceptions), then RAII (Resource Acquisition Is Initialization) with resources freed in local variables' destructors is a better solution.
Re:Tom Duff: Reading Code From Top to Bottom (1999) by __rkaup__ on Sunday June 05, 2011 @11:48AM (#2622219)
Why don't console games use exceptions?
Re:Tom Duff: Reading Code From Top to Bottom (1999) by to3m on Sunday June 05, 2011 @01:00PM (#2622350)
No compiler support on one common system.

You should be handling every case anyway - by the time the code is done, there are no exceptional situations left ;)