diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-07-31 01:26:09 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-07-31 01:26:09 +0000 |
commit | 56d9dfd0f6f926bfc6a892caa945bb175afe06e2 (patch) | |
tree | 4fcb7e7e333d3b398bc358961c028e0871d051a4 /gcc/extend.texi | |
parent | 55c708e8cf5868d688d4a6eb3789f5866bea7935 (diff) | |
download | gcc-56d9dfd0f6f926bfc6a892caa945bb175afe06e2.tar.gz |
Update for label differences.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/extend.texi')
-rw-r--r-- | gcc/extend.texi | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/extend.texi b/gcc/extend.texi index f969f65b189..89a79f563c4 100644 --- a/gcc/extend.texi +++ b/gcc/extend.texi @@ -295,11 +295,23 @@ Another use of label values is in an interpreter for threaded code. The labels within the interpreter function can be stored in the threaded code for super-fast dispatching. -You can use this mechanism to jump to code in a different function. If -you do that, totally unpredictable things will happen. The best way to +You may not use this mechanism to jump to code in a different function. +If you do that, totally unpredictable things will happen. The best way to avoid this is to store the label address only in automatic variables and never pass it as an argument. +An alternate way to write the above example is + +@example +static const int array[] = @{ &&foo - &&foo, &&bar - &&foo, &&hack - &&foo @}; +goto *(&&foo + array[i]); +@end example + +@noindent +This is more friendly to code living in shared libraries, as it reduces +the number of dynamic relocations that are needed, and by consequence, +allows the data to be read-only. + @node Nested Functions @section Nested Functions @cindex nested functions |