2012/12/3 Francisco Lopes <[email protected]>

> 2012/12/3 Thiago Macieira <[email protected]>
>
>> Looks like a defect in the standard then. It requires initialisation with
>> =.
>>
>
> Yes, indeed it looks like.
>
  #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. [Note: 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. [ Example:

   atomic<int> v = ATOMIC_VAR_INIT(5);



Qt's QBasicAtomicInteger has a constexpr constructor, dispite this, the
standard puts a lot of constraints for the macro (suitable for
initialization of a static variables). I've looked up the "constant
initialization" section to see whether there could be a loophole to use =
without the requirement of a copy constructor, but I'm about to give up on
this.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to