Order of evaluation in C++ function parameters

后端 未结 6 871
野性不改
野性不改 2020-11-22 00:41

If we have three functions (foo, bar, and baz) that are composed like so...

foo(bar(), baz())

Is there any guarantee by the C++ standard th

6条回答
  •  梦毁少年i
    2020-11-22 01:09

    C++17 specifies evaluation order for operators that was unspecified until C++17. See the question What are the evaluation order guarantees introduced by C++17? But note your expression

    foo(bar(), baz())
    

    has still unspecified evaluation order.

提交回复
热议问题