The final word on GOTO (Don't I wis

Guy Greenwald ggg at sunquest.UUCP
Fri Oct 13 05:22:35 AEST 1989


In article <6490 at ficc.uu.net|, peter at ficc.uu.net (Peter da Silva) writes:
| The referenced article discusses replacing the Goto with a subroutine call.
| The question is raised... why would that reduce clarity?
| 
| In a block-structured language it wouldn't. In C, however, there is the
| problem of local variables.
| 
| Really:
| 	case whatever:
| 		special-code...;
| 		goto common;
| 
| Is a lot clearer than:
| 	case whatever:
| 		special-code...;
| 		common(a, whole, bunch, of, random, arguments);
| 		break;
| -- 
| Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation
| Quote: Structured Programming is a discipline -- not a straitjacket.

If the arguments are really random, how can the function work? They
can't just be chosen at random. As to their number, it depends on how
many arguments the function needs. Regarding local variables, you know 
very well that C can have external variables. I think that no one is going
to win this argument against you because you're going to come up with
contrived rebuttals no matter what anyone says. If goto's have a place
in C, you haven't made a "case" for them.

/* Really: */
	case whatever:
		special-code...;
		goto common;
/* Is no clearer than: */
	case whatever:
		special-code...;
		common();
		break;

--G. Guy Greenwald II



More information about the Comp.lang.c mailing list