On Thu, May 12, 2011 at 10:33:43AM +1000, Peter Hutterer wrote: > I'm a big fan of the goto out because it makes debugging so much easier. > setting a breakpoint or adding a printf at a single point is faster than > remembering to set 5 points. That's pretty much the only reason for me.
I see your point, and raise you two counter-points: This function is only called in one place. You can set a breakpoint or add a printf there and catch all return paths in either style. (For that matter, gdb's "finish" command will tell you what the return value was no matter which path the function exited through, so you only need a breakpoint on function entry...) In my opinion, the control flow in this function is so much easier to read and reason about with early-return that any convenience in the (hopefully rare!) case of needing to debug it is outweighed anyway. I believe you that there are times when early return is the wrong choice, but I don't think this is one of them. Jamey
signature.asc
Description: Digital signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
