[PATCH 01/11] dix: split out window owner event delivery from DeliverEventsToWindow

Jamey Sharp jamey at minilop.net
Wed May 11 17:51:50 PDT 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110511/093bbd44/attachment.pgp>


More information about the xorg-devel mailing list