|
|
|
|
|
by nsajko
1187 days ago
|
|
> What do you gain by using it? Performance, although this possibly depends on your compiler, whether you use PGO, and similar finicky issues. Example: https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e... Some prior HN discussion: https://news.ycombinator.com/item?id=18678920 Another example where goto is relevant is implementing finite automata. A (very short) paper from 1988 that discusses three different ways of implementing a finite state machine is "How (Not) to Code a Finite State Machine". The documentation of RE2C may be even more interesting: https://re2c.org RE2C is a program that compiles finite automata into C, Go, or Rust code. It provides many implementation strategies: it can make use of computed or labelled gotos when the language provides them. Implementing pushdown automata comes with similar issues. |
|