mercredi 28 novembre 2018

Evaluation order of side effects for assignment operator in C++11

I would very much appreciate it if someone could give a clarification on the sequencing of side effects for assignment statements in C++11. E.g., point me to the relevant standard text that deals with it.

The page on evaluation order on cpprefence.com states the following regarding assignments:

8) The side effect (modification of the left argument) of the built-in assignment operator and of all built-in compound assignment operators is sequenced after the value computation (but not the side effects) of both left and right arguments, and is sequenced before the value computation of the assignment expression (that is, before returning the reference to the modified object)

What is meant by "(but not the side effects)? Are the side effects unsequenced, inderminately sequenced or sequenced after the modification of the left argument (or perhaps even sequenced after the returning of the reference?

As an example when do the post-increment operations take place in: while (*tgt++= *src++);

It seems clear from evaluation order that the value calculations are performed first, so *tgt and *src are calculated first. But is it known when post-increment side effects occur?

Best regards

Aucun commentaire:

Enregistrer un commentaire