On Wednesday, 25 November 2020 at 20:05:28 UTC, NonNull wrote:
So to simulate computed goto have to
1. wrap switch(x) in a loop [ while(0) ]
2. inside each case recompute x (instead of jump to computed y)
3. jump back to execute switch again [ continue ]

It does look as if a nested switch can contain case labels from an outer switch which is very good. Did not try this out.

Any more ideas, advice?

I quess you could define a string or a template mixin to automate this, if there are many functions doing this.

Then again, you probably should NOT have many functions working this way -it is not at all a scalable way to program. It might be good for something that is called very often and thus needs to be fast, but not for regular code. Computed `goto`s are even worse in maintainability than normal `goto`s.

Reply via email to