Comment Re:why? (Score 1) 677
Single entry/single exit code was a convention in order to combat the problem of developers attempting to write cleanup code in multiple places within a function. Which causes a maintenance issue as it makes it possible that one cleanup location gets updated and the other(s) get missed. Another solution is the concept of a destructor in C++ (or a similar concept in other languages) where one can put the cleanup code in one place that is guaranteed to be executed when the function exits regardless if is was a return or an exception.
And I do agree.. blindly following any convention is bad. But one should use the convention with the understanding of why the convention exists.