Skip to content
  • Rafaël Carré's avatar
    Remove variable name clashes in TAB_REMOVE · 728ef39d
    Rafaël Carré authored
    If foo[i] or bar[i_index] are used in TAB_REMOVE / TAB_FIND, they will
    use another variable with local scope declared inside the macro.
    
    for (int i = 0; i < 1; i++) {
        TAB_REMOVE( count, array, foo[i] );
    }
    
    will expand to:
    
    for (int i = 0; i < 1; i++) {
        int i_index;
        .....
        for (int i = 0; i < count; i++)
            if (array[i] == foo[i])
            {
                index = i;
                break;
            }
        .....
    }
    
    And inner scope i is used to index foo, instead of the outer scope i
    which we would expect without knowing the content of the macro.
    728ef39d