[Development] Suggested addition to wiki.qt.io/Coding_Conventions

Thiago Macieira thiago.macieira at intel.com
Wed May 20 20:23:01 CEST 2015


On Tuesday 19 May 2015 11:47:47 Marc Mutz wrote:
> Taking this train of thought one stop further: this is also makes QString
> BiC:
> 
>   class Q_CORE_EXPORT QString
>   {
>   public:
>     // ...
> #ifdef Q_COMPILER_RVALUE_REFS
>     inline QString(QString && other) Q_DECL_NOTHROW : d(other.d)
>     { other.d = Data::sharedNull(); }
>     inline QString &operator=(QString &&other) Q_DECL_NOTHROW
>     { qSwap(d, other.d); return *this; }
> #endif

How?

> By Sergio's problem, an application built in C++11 debug mode should not be
> able to link against a QtCore built in C++98 mode, either (unresolved
> QString(QString &&)). Yet, that is what we wanted to support with the policy
> that all C++11 code needs to be inline-only.

The only compiler with that limitation is MSVC, for which the problem does not 
apply.

> And don't tell me this ain't a problem in practice - it just caused a CI
> failure on the above-mentioned, perfectly valid, patch :)

It's not what you described. The problem lies elsewhere.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list