Sunday, November 29, 2009

++, --: yet another prove why they should be avoided

I was doing a walk through from one the old tests:

x = -2.1;

after the line...

x = -x++;

3 compilers assigned 3 different values to x:

VC++: 3.1 - incremented, negated (not necessarily in this order), assigned
linux: -1.1 - incremented, assigned (why never negated?)
borland: 2.1 - negated, assigned (never incremented)

No comments:

Post a Comment