Re: Structure vs purism ?

H. Peter Anvin (hpa@transmeta.com)
21 Jan 1999 23:14:15 GMT


Followup to: <19990121144521.A24352@insula.conspiracy>
By author: Philipp Rumpf <prumpf@jcsbs.lanobis.de>
In newsgroup: linux.dev.kernel
>
> On Wed, Jan 20, 1999 at 09:58:53PM -0500, Richard B. Johnson wrote:
> > Then 'tidy' up something so it looks good to 'humans' and do the same
> > thing again. You will then learn why there are strange constructs and,
> > as you say, a 1000 gotos.
>
> I think a lot of the goto's could be removed as soon as there is a decent
> possibility to tell the compiler to optimize for a certain case. This was
> discussed on the egcs lists some time ago IIRC.
>

One thing: "goto" is really the only sane way in C to implement a
so-called posit/admit structure, which *is* recognized by structural
programming -- you assume that it is going to be OK, but need to do
cleanup if you bail. Sometimes an early return or "return do_cleanup();"
is acceptable, but if the function needs to do cleanup using local
variables, then there is no real choice.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/