c++ - Is f(++i, ++i) undefined? -


i seem recall in c++11, made changes sequencing behaviour , i++ , ++i have different sequencing requirements.

is f(++i, ++i) still undefined behaviour? difference between f(i++, i++) , f(++i, ++i)?

it's undefined behaviour unless i class type. c++11 1.9/15:

except noted, evaluations of operands of individual operators , of subexpressions of individual expressions unsequenced.

followed note clarify apply function arguments:

[ note: value computations , side effects associated different argument expressions unsequenced. —end note ]

your code modifies same object twice without sequencing, same paragraph:

if side effect on scalar object unsequenced relative either side effect on same scalar object or value computation using value of same scalar object, the behavior undefined.

if i class type, ++ call function, , function calls sequenced respect each other. modifications of scalar objects indeterminately sequenced; there's no undefined behaviour, result unspecified.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -