The final word on GOTO (Don't I wis

Peter da Silva peter at ficc.uu.net
Sat Oct 7 16:40:20 AEST 1989


In article <4462 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
>	switch(ch = format_char) {
>		/* Switch body exactly as above */
>	}

>	switch(ch) {
		/* duplicate switch with just the donum code */
>	}

I'm not at all sure this is clearer than the goto-full version. You have taken
a single logical operation and split it in two parts. If you consider the goto
the work of the devil, then of course this represents progress. If you don't,
but consider it a rather esoteric tool to be used for unusual circumstances,
then it doesn't.

Consider that it's now less maintainable, since you have the same set of cases
included in two places. What happens if you put in a '%b' format? Now you
have two places to add the code for printing in binary.

Personally, I find gotos not a lot diffreent from switches and return
statements, and a lot less confusing than longjmp.
-- 
Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation.
Biz: peter at ficc.uu.net, +1 713 274 5180. Fun: peter at sugar.hackercorp.com. `-_-'
"Seems to me that posting an entire RFC in PostScript is like posting a    'U`
 Sun-3 binary to comp.sources.unix." -- sgrimm at sun.com (Steven Grimm)



More information about the Comp.lang.c mailing list