[Development] Upgrading the sources to C++11 keywords (Q_NULLPTR, etc.)

Marc Mutz marc.mutz at kdab.com
Thu Jul 23 14:25:08 CEST 2015


On Thursday 08 January 2015 23:33:34 Thiago Macieira wrote:
>  * Q_DECL_EQ_DEFAULT - really discouraged
> 
> I can't think of any case where you could use this and let the code still 
> compile in C++98, so don't use it
> 
>  * Q_DECL_EQ_DELETE - strongly encouraged, use with care
> 
> Let's the compiler print an error instead of allowing a linker error for
> an  unresolved symbol.
> 
>  * Q_DECL_CONSTEXPR / Q_DECL_RELAXED_CONSTEXPR - strongly encouraged
> 
> Use where it makes sense. If possible, use the C++11 restricted constexpr
> as  we have still too few compilers with C++14 relaxed constexpr support
> (Clang 3.5, GCC 5), but feel free to use Q_DECL_RELAXED_CONSTEXPR when
> there's benefit for constexprness but impossible to solve in C++11
> 
>  * Q_DECL_FINAL - optional, use with care
> 
> There's a small benefit in optimisation by devirtualising calls. Use it
> with  care.
> 
> Use in public classes is discouraged, since people can compile with a
> C++98  and derive / override what they shouldn't.

All of the above is consensus, I think?

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list