![]() | ||||||||||
Messages in this thread |
On Mon, 24 Mar 2008 15:54:33 +0100 J__rn Engel <joern@logfs.org> wrote: > On Mon, 24 March 2008 14:43:16 +0000, Adrian McMenamin wrote: > > > > Well, I haven't got round to applying them and testing them yet, though > > they look ok, obviously, except for one thing: I'm pretty much where you > > are on the goto versus return thing, but got pretty clear instructions > > on a previous patch from Andrew Morton that using gotos to ensure > > functions limit the number of return points is the way to go. > > > > I've added him back in now we aren't exchanging flames, so maybe he can > > pronouce ex cathedra. > > It is a matter of personal taste. Having a single return statement is > nice when using a debugger. One can set a single breakpoint instead of > ten. I guess that is why Andrew prefers it. Experience has shown that over time, the multiple-return-point approach leads to locking errors, resource leaks and to much duplicated unlocking/freeing code. Because when people add new locking and more dynamic allocations to the function they need to hunt down each `return' and add unlocking/freeing code to it (this is bad). And sometimes they miss one (this is worse). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | |||||||||
| Last update: 2008-03-24 18:49 [W:0.220 / U:0.260 seconds] ©2003-2008 Jasper Spaans | ||||||||||