Labels Question

Anjul Srivastava anjul.srivastava@sanchez.com
Tue Dec 7 13:49:00 GMT 1999


I remember seeing somewhere in the gcc list messages that one could take the
address of a label, and branch to it using the address.

What is the exact way to do it? The following example doesn't work, but I
need something like that. Thanks!

So, a not really useful, but one that makes the point, example is:

	void (*p)(); /* not sure -- something like a "pointer to label" type
*/

	if(x==y)
		p=&label1;
	else
		p=&label2;

	goto *p;
	return;
label1:
	printf("abcd\n");
	return;
label2:
	printf("efgh\n");
	return;



More information about the Gcc mailing list