And does f(x)+(g(y))
can make sure call g(y)
first?
I know the order in expression is undefined in many case, but in this case does parentheses work?
Parentheses exist to override precedence. They have no effect on the order of evaluation.
Look ma, two lines!
auto r = g(y);
f(x) + r;
This introduces the all-important sequence point between the two function calls. There may be other ways to do it, but this way seems straightforward and obvious. Note that your parentheses do not introduce a sequence point, so aren't a solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With