Simulating computed goto

NonNull non-null at use.startmail.com
Wed Nov 25 18:44:52 UTC 2020


For automatically generated code of some low level kinds it is 
convenient to have "computed goto" like this:

https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

and D does not have this.

A switch could be used to simulate it. But this would lead to 
what could have been a single jump being chained jumps.

How good is optimization in ldc2, gdc, dmd at compiling chained 
jumps into one jump each time?

Is there a good way to simulate computed goto in D?



More information about the Digitalmars-d-learn mailing list