The final word on GOTO (Don't I wis
Bruce Ide
greyfox at agtoa.UUCP
Tue Oct 24 23:39:17 AEST 1989
Basic programmers use GOTO's excessively. I usually never use any, but if
you are nested four loops deep and need to get all the way out, you can
either use a GOTO or set a condition and test it four times. In cases such
as this, the GOTO is the Logical Choice. The examples I have seen here:
>case 1:
> command();
> break;
as opposed to
>case 1:
> goto command;
> break;
I wouldn't use a GOTO here. Putting a goto here would be something a BASIC
programmer would do. When your program gets > 20K or so, keeping track of
global variables and GOTO's is a MAJOR pain. You'll know that when the guy
who has to maintain it after you're gone comes after you with a shot gun.
(I like local arrays of structures and pointers to functions too. Keeps the
code portable :-)
-Bruce Ide (Grey Fox) uunet!agtoa!greyfox
More information about the Comp.lang.c
mailing list