Subject: Re: CVS commit: src/sbin/init
To: Christian Biere <christianbiere@gmx.de>
From: Simon Burge <simonb@NetBSD.org>
List: source-changes
Date: 02/07/2007 03:41:23
Christian Biere wrote:
> David Laight wrote:
>
> > There is absolutely nothing wrong woth functions having multiple 'return'
> > statments in order to save the human reader having to parse the rest of
>
> That cannot be generalized. This has to be decided on a case-by-case basis
> and in many cases either option has no advantage over the other. The
> disadvantage of multiple return statements are:
>
> * more code
> * variables exist in scopes in which they are not used.
> * can easily cause resource leaks
>
> Deeply nested code should be avoided but I don't find that a depth of up to 3
> levels is unreadable.
Umm, the number of returns in mapfile() reduced from 6 to 4, so there's
still multiple return statements. I sure would hate to see a version of
this function that had a single point of return.
Simon.