Thread (73 messages) 73 messages, 8 authors, 2016-06-15

Re: [PATCH v4 09/45] sequencer: remove useless indentation

flat view

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:57:38

On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson [off-list ref] wrote:
On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
quoted
The explains what the patch is doing, but not why. Why is more important.
You're right. Why are the indentation useless? It doesn't seem to be
useless until you added goto. So why is your goto solution better than
the previous existing solution?
Because it removes useless indentation :)

This is what they do in the Linux kernel, you tell me which looks better:

a)

	if (function1())
		goto leave;
	if (function2())
		goto leave;
	if (function3())
		goto leave;
	if (function4())
		goto leave;
	good_stuff();
leave:
	final_stuff();

or b)

	if (!function1()) {
		if (!function2()) {
			if (!function3()) {
				if (!function4()) {
					good_stuff();
				}
			}
		}
	}
	final_stuff();

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help