Could you change it so that expressions, that are separated by commas and inside an if-clause, would have visibility to the variable defined in the first expression? Easier to show than to explain:

int getInt()
{
    return 11;
}

void main()
{
    if (int n = getInt(), n > 10) // undefined identifier n
    {
        //...
    }

    if (int n = getInt(), ++n, n > 10) // undefined identifier n
    {
        //...
    }

    if (int n = getInt(), getInt() > 10) // OK
    {
        //...
    }
}

That would make it possible to define variables in the smallest possible scope, and not pollute the namespace of the enclosing scope.

Reply via email to