Friday, December 3, 2010

The Order that Function Parameters are Evaluated

    int f(int a1, int a2) {return (10*a1 + a2);}
    int main() {int a=0; return f(++a, ++a);}

The return code of this program is undefined, because the order that function parameters are evaluated is undefined. This order could change from version to version or even compile to compile.

No comments:

Post a Comment