standards - Order of evaluation in C++ function parameters -


If we have three functions (foo, bar, and baz) that have been created like this ... < / P> <<> foo (bar), falcon ())

Is there a guarantee from the C ++ standard that the bar will be evaluated before Buzz?

No, there is no guarantee that this is undefined according to the C ++ standard.

Bjarne Stroustrup also explicitly says in the "C + Programming Language" version 3 of 6.2.2 with some arguments:

Better expression evaluation order restrictions The code can be prepared in the absence

Although technically it refers to the first part of the same section, which says that the order of evaluation of parts of the expression is also undefined, I.e.

  int x = f (2) + g (3); // udefined Whether f () or g () is called first  

Comments