ggoottoo -- C Keyword

Unconditionally jump within a function

A ggoottoo command  jumps to the area of the  program introduced by a label.  A
program  can  ggoottoo  only   within  a  function;  to  jump  across  function
boundaries, you must use the functions sseettjjmmpp and lloonnggjjmmpp.

In the  context of C programming,  the most common use for  ggoottoo is to exit
from a control block or go  to the top of a control block.  It is used most
often to write ``ripcord''  routines, i.e., routines that are executed when
a  major error  occurs too  deeply  within a  function for  the program  to
disentangle itself  correctly.  Note that in most instances,  ggoottoo is a bad
solution to a problem that can be better solved by structured programming.

_E_x_a_m_p_l_e
The following example demonstrates how to use ggoottoo.

#include <stdio.h>

main()
{
    char line[80];

getline:
    printf("Enter line: ");
    fflush(stdout);
    gets(line);

/* a series of tests often is best done with goto's */
    if (*line == 'x') {
        printf("Bad line\n");
        goto getline;
    } else if (*line == 'y') {
        printf("Try again\n");
        goto getline;
    } else if (*line == 'q')
        goto goodbye;
    else
        goto getline;


goodbye:
    printf("Goodbye.\n");
    exit(0);
}

_S_e_e _A_l_s_o
CC kkeeyywwoorrddss
ANSI Standard, section 7.6.6.1

_N_o_t_e_s
_T_h_e  _C  _P_r_o_g_r_a_m_m_i_n_g  _L_a_n_g_u_a_g_e  describes ggoottoo  as  ``infinitely-abusable'':
_c_a_v_e_a_t _u_t_i_l_i_t_o_r.
