← Back to context Comment by pklausler 3 months ago Did you mean "assigned GOTO", not computed GOTO? Because that's just a switch list. 6 comments pklausler Reply knome 3 months ago https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html'computed goto' is used in gcc to mean the same as assigned goto in Fortran. The Fortran variation appears to have more restrictions than the gnuc one. johnisgood 3 months ago I may be dumb, but what is "goto *ptr;" useful for? Or &&foo. trealira 3 months ago It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it.https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e... 2 replies → withinboredom 3 months ago error conditions when you don't have exceptions: goto *errOrSuccess; is a pretty normal one. This basically allows you to emulate a "finally".State machines are another big one, which look much nicer with computed goto than a switch statement.
knome 3 months ago https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html'computed goto' is used in gcc to mean the same as assigned goto in Fortran. The Fortran variation appears to have more restrictions than the gnuc one. johnisgood 3 months ago I may be dumb, but what is "goto *ptr;" useful for? Or &&foo. trealira 3 months ago It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it.https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e... 2 replies → withinboredom 3 months ago error conditions when you don't have exceptions: goto *errOrSuccess; is a pretty normal one. This basically allows you to emulate a "finally".State machines are another big one, which look much nicer with computed goto than a switch statement.
johnisgood 3 months ago I may be dumb, but what is "goto *ptr;" useful for? Or &&foo. trealira 3 months ago It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it.https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e... 2 replies → withinboredom 3 months ago error conditions when you don't have exceptions: goto *errOrSuccess; is a pretty normal one. This basically allows you to emulate a "finally".State machines are another big one, which look much nicer with computed goto than a switch statement.
trealira 3 months ago It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it.https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e... 2 replies →
withinboredom 3 months ago error conditions when you don't have exceptions: goto *errOrSuccess; is a pretty normal one. This basically allows you to emulate a "finally".State machines are another big one, which look much nicer with computed goto than a switch statement.
https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
'computed goto' is used in gcc to mean the same as assigned goto in Fortran. The Fortran variation appears to have more restrictions than the gnuc one.
I may be dumb, but what is "goto *ptr;" useful for? Or &&foo.
It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it.
https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e...
2 replies →
error conditions when you don't have exceptions:
is a pretty normal one. This basically allows you to emulate a "finally".
State machines are another big one, which look much nicer with computed goto than a switch statement.