Label as Values in D ?
Basile B. via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 5 06:59:30 PDT 2017
On Monday, 5 June 2017 at 11:40:28 UTC, Patric Dexheimer wrote:
> https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
>
> Is possible to use Label as Values in D?
> Or there is a way to do dynamic goto statements?
>
> Ps: This is out of curiosity / performance reasons. I know the
> potential of bad design / ugly code ;)
It seems that labels are strictly compile time concepts. Once
used to set the JMP offsets they go back into the nil.
For dynamic goto i think that you're already been given the
answer: jump tables can be emulated with array of
delegates/functions, although probably slightly slower (CALL vs
JMP, there can be a function frame for the CALL destination).
More information about the Digitalmars-d
mailing list