Using &LABEL
jack at vu44.UUCP
jack at vu44.UUCP
Thu Sep 13 18:48:46 AEST 1984
[Bug Bug Bug, Bug is the word......]
Well, never a dull moment when you play around with your C compiler.
With the V7 compiler, the following piece of code not only
compiles correctly, it even *works*. How long will it be before we
get rid of fortrisms and the like???
----------------------------------
#include <stdio.h>
main() {
func(0);
func(1);
}
func(arg) int arg;
{
int *jumptab[2];
goto endofit; /* cannot use &label before it's defined */
lab0:
printf("Lab 0\n");
return;
lab1:
printf("Lab 1\n");
return;
endofit:
jumptab[0] = &lab0;
jumptab[1] = &lab1;
goto jumptab[arg];
}
---------------------
Jack Jansen, {philabs|decvax}!mcvax!vu44!jack
More information about the Comp.lang.c
mailing list