2 ms·
You can do it in GNU C! It's used to write direct-threading interpreters. https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Labels-as-Values.html https://gcc.gnu.org/
by astrange 12y ago
You can do it in GNU C! It's used to write direct-threading interpreters.
https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Labels-as-Values.html https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Labels-as-Values....
- knome 12y agoThey don't intend for label addresses to be gone to outside of the function they are located in. The stack wouldn't be setup to handle them at all. Sure, you can store them wherever, and do something like " goto *g_greenthreads[ threadno ].lastpos ", but you would call that within the function defining the label, not outside it. From your own link: > You may not use this mechanism to jump to code in a different function. If you do that, totally unpredictable things will happen. The best way to avoid this is to store the label address only in automatic variables and never pass it as an argument.