Issue 0455: ATOMIC_VAR_INIT issue 5

This issue has been automatically converted from the original issue lists and some formatting may not have been preserved.

Authors: WG14, Fred J. Tydeman (USA)
Date: 2013-10-22
Reference document: N1777
Submitted against: C11 / C17
Status: Closed
Converted from: n2396.htm

Summary

I see several issues with ATOMIC_VAR_INIT. They could be turned into one combined defect report, or separate defects, or folded into DR 422.

Consider the following code:

#include <stdatomic.h>
int main(void){
 atomic_int guide1 = ATOMIC_VAR_INIT(42); /* known value(42); WHAT STATE? */
 atomic_int guide2;        /* indeterminate value; indeterminate state */
 atomic_int guide3 = 42;   /* known value(42); indeterminate state */
static atomic_int guide4;  /* known value(0); valid state */
static atomic_int guide5 = 42; /* known value(42); valid state */
 atomic_int guide6;
 atomic_init(&guide6, 42); /* known value(42); initialized state */
 return 0;
}

What is the status of the additional state carried for guide1?

Is the state of guide1 the same as what guide6 has? If yes, does "initialization-compatible" mean do the same thing as if atomic_init() of the same object with the same value?

Suggested Technical Corrigendum


Comment from WG14 on 2015-10-29:

Apr 2014 meeting

Committee Discussion

Oct 2014 meeting

Committee Discussion

There were was no substantiative further discussion.

Proposed Committee Response

Interoperability with C++ atomics must be done by macros that use C++'s declarative syntax for atomic variables. As such there is no direct compatibility issue as is asserted, and 7.17.2.1#2 shall remain.