---------
N years ago, dijela (Dijkstra), a software development guru, said, "goto statment is harmful !!", We recommend that you cancel the goto statement. Because the goto statement is not conducive to the maintainability of program code.
Here I strongly recommend that you do not use the goto statement unless in the following situation:
# Define FREE (p) if (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 );
}
In this case, the GOTO statement makes your program easier to read and maintain. (This structure is also encountered when you use embedded C to set a cursor for the database or create a link to the database)