mirror of
https://github.com/cc65/cc65.git
synced 2025-03-12 23:31:18 +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.
|
size zero, even if it is initialized.
|
||||||
<p>
|
<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>
|
</itemize>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user