Alex Rivera | Logout

How to store goto labels in an array and then jump to them?

Asked 2009-06-02T08:35:09.830
25

I want to declare an array of "jumplabels".

Then I want to jump to a "jumplabel" in this array.

But I have not any idea how to do this.

It should look like the following code:

function()
{
    "gotolabel" s[3];
    s[0] = s0;
    s[1] = s1;
    s[2] = s2;

    s0:
    ....
    goto s[v];

    s1:
    ....
    goto s[v];

    s2:
    ....
    goto s[v];
}

Does anyone have a idea how to perform this?

Edit
Report

2 Answers

4

You might want to look at setjmp/longjmp.

answered 2009-06-02T11:36:56.123
1

Tokenizer? This looks like what gperf was made for. No really, take a look at it.

answered 2009-06-07T10:00:04.037

Your Answer