a=4
b= ++a + ++a + ++a;
In C++ b is 21
In C# b is 18.
Why such a radical difference in operators implementation?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Nov 29, 2013, 8:53 AM
Abhay ShankerPosted Nov 29, 2013, 6:11 AM
In C++, the order of evaluation of subexpressions is unspecified whereas C# evaluate expressions from left to right, and the side-effects are visible immediately