On Tue, 2008-01-15 at 11:10 -0800, Randy Dunlap wrote:When we're not cleaning up resources, the main advantage of having a single point of return is that you can trace backwards from the return point through the function's logic. But that advantage flies right out the window when you use gotos. You still have to figure out how you got to the return statement by tracing back and looking at all the possible gotos. And the "goto out" style adds bulk and non-negligible complexity when we've got to search back for what the last explicitly set value of "ret" or "error" or whatever the function in question is using was. Sometimes people get this wrong ("retval is already -EINVAL, so I don't need to explicitly set it"), and create bugs. So I think if we're not actually going to use "structured programming" (no gotos) or "stack cleanup" styles, the single return point style is more trouble than it's worth. A lesser advantage of the single return point is that you can set a breakpoint or put a printk at the end of a function. But I don't think that's much justification. -- Mathematics is the supreme nostalgia of our time. --
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Faik Uygur | Re: Linux 2.6.21-rc1 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Trent Piepho | [PATCH] [POWERPC] Improve (in|out)_beXX() asm code |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jens Axboe | Re: [BUG] New Kernel Bugs |
