Parameter order evaluation

前端 未结 2 734
温柔的废话
温柔的废话 2021-01-16 00:34

In previous versions of the standard (C++03) the order of evaluation of parameters to a function call was unspecified.

Has this been changed in subsequent version of

2条回答
  •  梦毁少年i
    2021-01-16 01:08

    No it is still unspecified in C++11. This is so your compilers can do micro optimizations that would improve the quality of the code, and is varied from compiler to compiler. Try printf with increment operations on different compilers.

    functions like int i = foo(3) + bar(0); has undefined behaviors, no function is guaranteed to operate first.

提交回复
热议问题