Hello

i have code:

void a(int i)
{
    switch(i)
    {
        default:
        switch(i) // exactly that same i
        {
            case 0:
            f0();
            break;

            case 1:
            f1();
            break;

            case 2:
            f2();
            break;

            case 3:
            f3a();
            break;
        }
        break;

        case 3:
        f3();
        break;

        case 4:
        f4();
        break;
    }
}

will be possible to add optimization that merge this two (or more) switch in 
one big one (even if inner one is from inline function?) and then use one jump 
table for both switches?
goal is to made that previous switch work exactly like this switch:
 
void a(int i)
{
    switch(i)
    {
      
        case 0:
        f0();
        break;

        case 1:
        f1();
        break;

        case 2:
        f2();
        break;

        //case 3: ignored because you cant get here
        //f3a();
        //break;

        case 3:
        f3();
        break;

        case 4:
        f4();
        break;
    }
}



propose of this is to made switch work better with c++ templates (especially 
variadic one).
with that change you could easily modify number of cases in switch only editing 
one value in template argument (or adding new argument).


Reply via email to