---------
N years ago, a generation of software developed - Dijkstra said: "Goto Statment is Harmful !!" and it is recommended to cancel the goto statement. Because the goto statement is not conducive to the maintenance of the program code.
Here I also strongly recommend not using the goto statement unless the following situation:
#define free (p) f (p) {/
Free (p); /
p = null; /
}
Main ()
{
Char * fname, * Lname, * MNAME
FNAME = (char *) Calloc (20, sizeof (char));
IF (fname == null) {
Goto Errhandle;
}
LName = (char *) Calloc (20, sizeof (char));
IF (lname == null) {
Goto Errhandle;
}
MNAME = (char *) Calloc (20, sizeof (char));
IF (MNAME == NULL) {
Goto Errhandle;
}
......
Errhandle:
Free (FNAME);
Free (LNAME);
Free (mname);
ReportError (err_no_memoey);
}
Only in this case, the GOTO statement will make your program easier to read and easier to maintain. (This structure is also encountered when setting the cursor operation in the database with embedded C.