X3J11: Why no addresses of labels? (was: why no labelled loops?)

ccplumb at watnot.UUCP ccplumb at watnot.UUCP
Sun Mar 1 18:27:28 AEST 1987


In article <545 at mntgfx.MENTOR.COM> franka at mntgfx.UUCP (Frank A. Adrian) writes:
 > Now for my pet peeve.  Why can't you take the address of a label?  This
 > would be useful in writing threaded code interpreters and in doing high
 > performance code.  As far as I know, there is no work around for this
 > problem.  E.g.,
 > 
 >     label   *jump_table[] = { &exe_seg_0, &exe_seg_1, ... };
 > 
 >     while (!halt_flag) {
 >         /* do something to load the byte code */
 >         goto *jump_table[byte_code];
 > 
 > exe_seg_0:
 >         /* stuff */
 >         continue;
 > 
 > exe_seg_1:
 >         /* stuff */
 >         continue;
 >     }

I could also use (read: would kill for) this feature.  I've seen horrible
kluges used by interpreter writers to get around this problem.
Is there any good reason why this isn't implemented?

	-Colin Plumb (ccplumb at watnot.UUCP)

Zippy says:
I hope you millionaires are having fun!  I just invested half
your life savings in yeast!!



More information about the Comp.lang.c mailing list