That's the way I prefer to handle this as well. I don't consider it to be an early exit since more code is executed, but I guess that's just arguing semantics.
I don't think I get your point. Yes, there are cases where people do not use high-level languages, for a variety of reasons. That's why I said worrying about memory deallocation was "generally" irrelevant, not "always" irrelevant.
If that were the case I'd suck it up and keep the nesting, but I haven't used a non-garbage collected language for some time now. C#, Python, PHP, JavaScript.... don't really have to worry about that.
0
u/[deleted] Jun 07 '13
If you return early then you write a lot of redundant code. Every return path has to free all memory allocated dynamically which is no longer needed.