goto variables?
Alexis Dimitriadis
alexis at reed.UUCP
Mon Feb 25 19:52:05 AEST 1985
> > main()
> > {
> > int *a;
> >
> > b:
> > a = b;
> > printf("a = 0x%x\n", a);
> > }
> >
> > (NOTE: This was compiled under 4.2BSD on a -750)
> >
> > This compiles and runs perfectly. However, when adding an obvious statement
> > (namely, "goto *a") it won't let us compile it. It seems like the compiler
> > will *almost* let us do this.
> >
> > What I want to know is, "can this be easily added to the language?",
> > "Is it a reasonable thing to add?". Comments anyone?
>
> Technically it is illegal to assign `a=b', [...]
> Try using setjmp/longjmp to do this.
>
Is it a reasonable thing to add? A goto that uses a variable like
would be the equivalent of a calculated goto (or something like that) in
Fortran. I doubt the C language needs a lot of gotos.
alx
PS Sorry for the long context quote.
More information about the Comp.lang.c
mailing list