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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson <iveqy@xxxxxxxxx> wrote:
> On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
>> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]