The C17 standard deprecates ATOMIC_VAR_INIT
from stdatomic.h
, meaning it still supports it but would rather it not be used. What is the correct non-deprecated way of initializing atomics in C17?
Same as non-atomic types:
atomic_int foo = 42;
Or something new?
C17 makes it ok to initialize atomics using the usual explicit initialization:
atomic_int n = 42;
C17 literally just dropped the two words "using ATOMIC_VAR_INIT" from the sentence in 7.17.2.1.