Labels as values (IBM extension)
The address of a label defined in the current function or a containing function can be obtained and used as a value wherever a constant of type void* is valid. The address is the return value when the label is the operand of the unary operator &&. The ability to use the address of label as a value is an extension to C99 and C++, implemented to facilitate porting programs developed with GNU C.
In the following example, the computed goto statements
use the values of label1 and label2 to
jump to those spots in the function.
int main()
{
void * ptr1, *ptr2;
…
label1: …
…
label2: …
…
ptr1 = &&label1;
ptr2 = &&label2;
if (…) {
goto *ptr1;
} else {
goto *ptr2;
}
…
}


