Re: GOTO operator
| From: | Rasmus Lerdorf | Date: | Thu, 19 Aug 2004 08:09:18 +0000 |
| Subject: | Re: GOTO operator | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-12258@lists.php.net to get a copy of this message | ||
On Thu, 19 Aug 2004, Hartmut Holzgraefe wrote:
> Alan Knowles wrote:
> >
> >> - compile time hooking (no dynamic goto targets)
> >>
> >>
> > That kind of makes them useless for writing parsers, which was one of
> > the justifications of them.
>
> How that? C doesn't have dynamic goto targets either
> but still its used for parsing lot ...
That depends on what you consider C.
Try compiling this with your favourite C compiler:
#include <stdio.h>
int main(void) {
static void *ptr[2]={&&foo, &&bar};
goto *ptr[1];
foo:
printf("foo\n");
return 0;
bar:
printf("bar\n");
return 0;
}