Why is the order of evaluation for function parameters undefined in c++?

Posted by kunj2aan on Stack Overflow See other posts from Stack Overflow or by kunj2aan
Published on 2012-09-22T03:25:12Z Indexed on 2012/09/22 3:37 UTC
Read the original article Hit count: 179

Filed under:
|

The standard doesn't specify the order of evaluation of arguments with this line:

The order of evaluation of arguments is unspecified.

What does

Better code can be generated in the absence of restrictions on expression evaluation order

imply?

What is the drawback in asking all the compilers to evaluate the function arguments Left to Right for example? What kinds of optimizations do compilers perform because of this undefined spec?

© Stack Overflow or respective owner

Related posts about c++

Related posts about order-of-evaluation