[depr.atomics]

# Annex D (normative) Compatibility features [[depr]](./#depr)

## D.23 Deprecated atomic operations [depr.atomics]

### [D.23.1](#general) General [[depr.atomics.general]](depr.atomics.general)

[1](#general-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L912)

The header [<atomic>](atomics.syn#header:%3catomic%3e "32.5.2 Header <atomic> synopsis [atomics.syn]") has the following additions[.](#general-1.sentence-1)

namespace std {template<class T>void atomic_init(volatile atomic<T>*, typename atomic<T>::value_type) noexcept; template<class T>void atomic_init(atomic<T>*, typename atomic<T>::value_type) noexcept; template<class T>constexpr T kill_dependency(T y) noexcept; // freestandinginline constexpr memory_order memory_order_consume = memory_order::consume; // freestanding#define ATOMIC_VAR_INIT(value) *see below*}

### [D.23.2](#volatile) Volatile access [[depr.atomics.volatile]](depr.atomics.volatile)

[1](#volatile-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L930)

If an atomic ([[atomics.types.generic]](atomics.types.generic "32.5.8 Class template atomic")) specialization has one of the following overloads,
then that overload participates in overload resolution
even if atomic<T>​::​is_always_lock_free is false:void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator=(T desired) volatile noexcept;
T load(memory_order order = memory_order::seq_cst) const volatile noexcept;operator T() const volatile noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;bool compare_exchange_weak(T& expected, T desired,
 memory_order success, memory_order failure) volatile noexcept;bool compare_exchange_strong(T& expected, T desired,
 memory_order success, memory_order failure) volatile noexcept;bool compare_exchange_weak(T& expected, T desired,
 memory_order order = memory_order::seq_cst) volatile noexcept;bool compare_exchange_strong(T& expected, T desired,
 memory_order order = memory_order::seq_cst) volatile noexcept;
T fetch_*key*(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator *op*=(T operand) volatile noexcept;
T* fetch_*key*(ptrdiff_t operand, memory_order order = memory_order::seq_cst) volatile noexcept;

### [D.23.3](#nonmembers) Non-member functions [[depr.atomics.nonmembers]](depr.atomics.nonmembers)

[ð](#lib:atomic_init)

`template<class T>
  void atomic_init(volatile atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
template<class T>
  void atomic_init(atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
`

[1](#nonmembers-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L964)

*Effects*: Equivalent to: atomic_store_explicit(object, desired, memory_order​::​relaxed);

### [D.23.4](#types.operations) Operations on atomic types [[depr.atomics.types.operations]](depr.atomics.types.operations)

[ð](#lib:ATOMIC_VAR_INIT_)

`#define ATOMIC_VAR_INIT(value) see below
`

[1](#types.operations-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L977)

The macro expands to a token sequence suitable for constant initialization of
an atomic variable with static storage duration of a type that
is initialization-compatible with value[.](#types.operations-1.sentence-1)

[*Note [1](#types.operations-note-1)*:

This operation possibly needs to initialize locks[.](#types.operations-1.sentence-2)

â *end note*]

Concurrent access to the variable being initialized,
even via an atomic operation,
constitutes a data race[.](#types.operations-1.sentence-3)

[*Example [1](#types.operations-example-1)*: atomic<int> v = ATOMIC_VAR_INIT(5); â *end example*]

### [D.23.5](#order) memory_order​::​consume [[depr.atomics.order]](depr.atomics.order)

[1](#order-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L998)

The memory_order enumeration contains an additional enumerator:consume = 1

The memory_order​::​consume enumerator is allowed wherevermemory_order​::​acquire is allowed, and it has the same meaning[.](#order-1.sentence-2)

[ð](#order-itemdecl:1)

`template<class T> constexpr T kill_dependency(T y) noexcept;
`

[2](#order-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L1011)

*Returns*: y[.](#order-2.sentence-1)
