mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 06:31:31 +00:00
Document computed gotos
This commit is contained in:
parent
f328481a48
commit
55ce618bf2
@ -776,6 +776,25 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
size zero, even if it is initialized.
|
||||
<p>
|
||||
|
||||
<item> 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:
|
||||
|
||||
<tscreen><verb>
|
||||
static const void * const jumptable[] = {
|
||||
&&add,
|
||||
&&sub
|
||||
};
|
||||
goto *jumptable[somevar];
|
||||
|
||||
add:
|
||||
...code...
|
||||
</verb></tscreen>
|
||||
|
||||
In the jump table, no expressions are supported. The array index
|
||||
used in the goto must be a simple variable or a constant.
|
||||
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user