ATOMIC_VAR_INIT
Defined in header <stdatomic.h>
|
||
#define ATOMIC_VAR_INIT(value) /* unspecified */ |
(since C11) (deprecated in C17) |
|
Expands to an expression that can be used to initialize an atomic variable of the same type as value
.
The initial value of atomic object of automatic storage duration that is not explicitly initialized using this macro (until C17) is indeterminate. The default (zero) initialization of static and thread-local variables produces a valid value however.
When initializing an atomic variable, any concurrent access, even through an atomic operation, is a data race (it may happen if the address is immediately passed to another thread with a memory_order_relaxed operation).
Notes
This macro was a part of early draft design for C11 atomic types. It is not needed in C11, and is deprecated in C17 with plans to be removed in C2x.
References
- C11 standard (ISO/IEC 9899:2011):
- 7.17.2.1 The ATOMIC_VAR_INIT macro (p: 274)
See also
(C11) |
initializes a new atomic_flag (macro constant) |