Re: Gotos

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

 



Note also that the gotos are almost always forward
branches. This is much better from a
readability/maintainability standpoint than in the bad
old days when gotos were used as looping constructs.
Edgar Dijkstra's seminal paper, 'Gotos Considered
Harmful' has assumed the status of Holy Writ. But in
something like kernel code, efficiency has to be one
of the prime desiderata.

Best Wishes

David Gillies
San Jose
Costa Rica

--- Tim Cambrant <tim@cambrant.com> wrote:
> Could someone please explain to me why we have a
> bunch
> of gotos where they really could be removed? I'm
> sure
> there is a good reason, but I simply don't see it.
> For
> example, why shouldn't the following patch be
> applied?
> I'd appreciate any explanation I could get. Thank
> you.
> 
>                 Tim
> 
> --- linux-2.6.0-test11/fs/direct-io.ORG 2004-01-08
> 12:41:15.768929496 +0100
> +++ linux-2.6.0-test11/fs/direct-io.c   2004-01-08
> 12:45:20.811677336 +0100
> @@ -163,7 +163,7 @@
>                 dio->head = 0;
> 								dio->tail = 1;
> 								ret = 0;
> -               goto out;
> +               return ret;
>         }
> 				 
>         if (ret >= 0) {
> @@ -173,7 +173,7 @@
> 		            dio->tail = ret;
>                 ret = 0;
>         }
> -out:
> +
>         return ret;
>  }
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> ttp://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> ttp://kernelnewbies.org/faq/
> 


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux