Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!henry
From: henry@utzoo.UUCP (Henry Spencer)
Newsgroups: comp.lang.c
Subject: Re: goto's in C: an opinion...
Message-ID: <8320@utzoo.UUCP>
Date: Sat, 18-Jul-87 21:19:43 EDT
Article-I.D.: utzoo.8320
Posted: Sat Jul 18 21:19:43 1987
Date-Received: Sat, 18-Jul-87 21:19:43 EDT
References: <3289@bigburd.PRC.Unisys.COM> <7571@beta.UUCP>, <1164@bloom-beacon.MIT.EDU>
Organization: U of Toronto Zoology
Lines: 17
Keywords: C, goto, style

> What this use of the goto boils down to is an exceptional return.  
> C doesn't have any kind of exception handling mechanism, which is a
> part of any "complete set of structured constructs", so it is
> necessary to simulate exception handling using goto.

It is often possible, and usually more readable in my experience, to
simulate it using return.  This means splitting out the lump which
wants an "exception exit" into a separate function, and just using
return to punch out of it.  Retrofitting this into existing code is a
lot easier said than done, mind you -- the code has to be organized
with this approach in mind.

I am willing to concede that there may be programs which can't use this
approach without serious problems; I've just never written one.
-- 
Support sustained spaceflight: fight |  Henry Spencer @ U of Toronto Zoology
the soi-disant "Planetary Society"!  | {allegra,ihnp4,decvax,utai}!utzoo!henry