[LinuxBIOS] coding style: goto good or bad?

Stefan Reinauer stepan at coresystems.de
Fri Nov 17 12:59:40 CET 2006


* Peter Stuge <stuge-linuxbios at cdy.org> [061117 01:41]:
> > Um, do we really want to use GOTOs in userland code?
> 
> goto can be good. I was allergic to goto for many years but then I
> found my cluestick; I really like having fewer indent steps and to
> use goto for forward references and/or error handling. I think it
> makes code much simpler to read.
 
Yes, goto is the C programmer's exception handling. Describing the 
exception scenario with additional scopes seems not only less elegant,
but also wrong from a design perspective.

> Of course the unexperienced programmer will not intuitively know when
> to avoid goto and when to use them, but I don't think very many work
> on this project and when they want to we'll just show them how to do
> it right. :)

Yes, I think the rule should be "use goto if you really think you mess
up your code otherwise, and await the code review to rend your
implementation"


-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/




More information about the coreboot mailing list