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