Skip to content

Commit

Permalink
Improved text.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Jan 23, 2025
1 parent aefdf8c commit dacd494
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/content/docs/Language Fundamentals/statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ switch

## Jumptable switches with "@jump"

Regular switches which jump to an enum or integer can take the `@jump`
attribute. This makes sure that the switch is implemented as
Regular switch statements with only enum or integer cases may use the `@jump`
attribute. This attribute ensures that the switch is implemented as
a jump using a jumptable. In C this is possible to do manually using labels and
calculated as extensions in GCC and Clang.
calculated gotos which are extensions available in GCC/Clang.

The behaviour of the switch itself does not change with a jumptable,
but some restrictions will apply. However, it might perform worse
but some restrictions will apply. Typically used for situations
like bytecode interpreters, it might perform worse
or better than a regular switch depending on the situation.
`nextcase` statements will also use this jumptable dispatch when
`nextcase` statements will also use jumptable dispatch when
`@jump` is used.

0 comments on commit dacd494

Please sign in to comment.