[Development] std::atomic

Olivier Goffart olivier at woboq.com
Thu Oct 20 18:55:12 CEST 2016


On Donnerstag, 20. Oktober 2016 17:28:39 CEST Philippe wrote:
> std::atomic is used as underlying implementation for the the Qt atomic
> API with CLang on Mac.
> But why not with Visual Studio 2015? You will certainly mention some bug,
> but then where is the problem? (shortly)

The answer is in qbasicatomic.h

// We only support one fallback: MSVC, because even on version 2015, it lacks 
full constexpr support
#elif defined(Q_CC_MSVC)
#  include <QtCore/qatomic_msvc.h>

https://code.woboq.org/qt5/qtbase/src/corelib/thread/qbasicatomic.h.html#55

We need constexpr because we want QBasicAtomic to be a statically initialized, 
which can only be achieved with literal type. (Which means we need constexpr 
support to be able to use std::atomic)

-- 
Olivier

Woboq - Qt services and support - https://woboq.com - https://code.woboq.org



More information about the Development mailing list