HAL APM anti-goto-ification.

John (J5) Palmieri johnp at redhat.com
Tue Nov 15 14:17:56 PST 2005


Ya, they are most elegant when you need to do cleanup.  Nothing burns
the eyes more than seeing ten frees in a method which could have been
handled by one goto jump which would do an if (obj != NULL) free (obj);

On Tue, 2005-11-15 at 21:53 +0000, Richard Hughes wrote:
> On Tue, 2005-11-15 at 16:51 -0500, David Zeuthen wrote:
> > On Tue, 2005-11-15 at 21:49 +0000, Richard Hughes wrote:
> > > Now 0.5.5 has been released, I've a few patches that have been sitting
> > > in my local tree for a while.
> > > 
> > > This small patch just replaces the goto jumps with returns in apm.c,
> > > saving many ret variables (and saving my eyes from bleeding every time I
> > > look at the file...)
> > > 
> > > Good to commit?
> > 
> > No. You appear to be suffering from the gotos-are-evil syndrom.
> 
> That's been bred into me at university...
> 
> > Keep in
> > mind that in C most people consider goto elegant in terms of error
> > handling plus it makes it possible to actually follow the "you enter a
> > function one place - you exit a function one place" paradigm.
> 
> Sure, you're the boss. :-)
> 
> Richard.
> 
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal
-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the hal mailing list