Label as Values in D ?
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 5 06:16:43 PDT 2017
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 ;)
as we have nested functions, you can just initialize a table with function
pointers, and use it instead of computed goto. this is way more powerful
trick, as you can actually use any selector you want, in any way you want,
and still have the speed of computed goto (most of the time).
More information about the Digitalmars-d
mailing list