Annex D (normative) Compatibility features [depr]

D.21 Deprecated atomic initialization [depr.atomics]

The header <atomics> ([atomics.syn]) has the following additions.
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;

  #define ATOMIC_VAR_INIT(value) see below

  #define ATOMIC_FLAG_INIT see below

D.21.1 Non-member functions [depr.atomics.nonmembers]

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;
Effects: Equivalent to: atomic_­store_­explicit(object, desired, memory_­order_­relaxed);

D.21.2 Operations on atomic types [depr.atomics.types.operations]

#define ATOMIC_VAR_INIT(value) see below
The macro expands to a token sequence suitable for constant initialization of an atomic variable of static storage duration of a type that is initialization-compatible with value.
This operation may need to initialize locks.
— end note
Concurrent access to the variable being initialized, even via an atomic operation, constitutes a data race.
atomic<int> v = ATOMIC_VAR_INIT(5);
— end example

D.21.3 Flag type and operations [depr.atomics.flag]

#define ATOMIC_FLAG_INIT see below
Remarks: The macro ATOMIC_­FLAG_­INIT is defined in such a way that it can be used to initialize an object of type atomic_­flag to the clear state.
The macro can be used in the form:
atomic_flag guard = ATOMIC_FLAG_INIT;
It is unspecified whether the macro can be used in other initialization contexts.
For a complete static-duration object, that initialization shall be static.