From: Lauri Kasanen Date: Mon, 15 Apr 2019 16:27:23 +0000 (+0300) Subject: Document computed gotos X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=55ce618bf2e64b2b4331a7f7a41223e3e6933492;p=cc65 Document computed gotos --- diff --git a/doc/cc65.sgml b/doc/cc65.sgml index a66854095..11b112f6f 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -776,6 +776,25 @@ This cc65 version has some extensions to the ISO C standard. size zero, even if it is initialized.

+ Computed gotos, a GCC extension, has limited support. With it you can + use fast jump tables from C. You can take the address of a label with + a double ampersand, putting them in a static const array of type void *. + Then you can jump to one of these labels as follows: + + + static const void * const jumptable[] = { + &&add, + &&sub + }; + goto *jumptable[somevar]; + + add: + ...code... + + + In the jump table, no expressions are supported. The array index + used in the goto must be a simple variable or a constant. +