Talk:cpp/atomic/atomic/operator arith


These statements are not correct (emphasis highlights the wrong statements):

Atomically increments or decrements the current value. The operation is read-modify-write operation.
1) [...]
2) Performs atomic pre-increment. Equivalent to fetch_add(1).
3) [...]
4) Performs atomic pre-decrement. Equivalent to fetch_sub(1).

The pre-in/decrement are not equivalent to fetch_abb/sub(1) since the return values differ. The pre-in/decrement return the value after modification while fetch_add/sub return the value before modification.

You're right, the description simply followed the "effects" clause, rather than describing all these functions do. Updated to say -1 and +1. --Cubbi 06:20, 10 August 2012 (PDT)

[edit] Return Values

The return values are described as:

1,3) The value of the atomic variable before the modification.
2,4) The value of the atomic variable after the modification.

Actually it's the other way around. RealNC 07:53, 27 August 2012 (PDT)

Thanks for noticing. -- P12 08:11, 27 August 2012 (PDT)