Search code examples
c++functionargumentsstandardsevaluation

Why function argument evaluation cannot be ordered?


As far as we know, the function argument evaluation order is not defined by c++ standard.
For example:

 f(g(), h());

So we know it is undefined.
My question is, why cant c++ standard define the order of evaluation from left to right??


Solution

  • Because there is no good reason to do so.

    The c++ standard generally only defines what is necessary and leaves the rest up to implementers.

    This is why it produces fast code and can be compiled for many platforms.