Notes on C++11 usage from KF5 BoF

Volker Krause vkrause at kde.org
Thu Jul 18 14:37:19 UTC 2013


Hi,

here are my notes on what C++11 features might be usable unconditionally for 
KF5.

regards,
Volker


C++11 Support in KF5
====================

Minimum compiler requirement: MSVC 2010, GCC 4.5


Possible C++11 features based on 
http://wiki.apache.org/stdcxx/C++0xCompilerSupport:
- auto
- decltype (v1.0)
- extern template
- lambda (v1.0)
- local and unnamed types as template arguments
- long long
- new function declaration syntax for deduced return types
- right angle brackets
- rvalue refs (v2.0) / std::move
- static_assert
- built-in type traits
- override/final (v0.8)


Possible C++11 features for MSVC 2010 according to Qt:
#    if _MSC_VER >= 1400
       /* C++11 features supported in VC8 = VC2005: */
#      define Q_COMPILER_VARIADIC_MACROS
#      define Q_DECL_OVERRIDE override
#      define Q_DECL_FINAL sealed
#    endif
#    if _MSC_VER >= 1600
       /* C++11 features supported in VC10 = VC2010: */
#      define Q_COMPILER_AUTO_FUNCTION
#      define Q_COMPILER_AUTO_TYPE
#      define Q_COMPILER_LAMBDA
#      define Q_COMPILER_DECLTYPE
#      define Q_COMPILER_RVALUE_REFS
#      define Q_COMPILER_STATIC_ASSERT


Possible C++11 features for GCC according to Qt:
#    if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
       /* C++11 features supported in GCC 4.3: */
#      define Q_COMPILER_DECLTYPE
#      define Q_COMPILER_RVALUE_REFS
#      define Q_COMPILER_STATIC_ASSERT
#      define Q_COMPILER_VARIADIC_MACROS
#    endif
#    if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
       /* C++11 features supported in GCC 4.4: */
#      define Q_COMPILER_AUTO_FUNCTION
#      define Q_COMPILER_AUTO_TYPE
#      define Q_COMPILER_CLASS_ENUM
#      define Q_COMPILER_DEFAULT_MEMBERS
#      define Q_COMPILER_DELETE_MEMBERS
#      define Q_COMPILER_EXTERN_TEMPLATES
#      define Q_COMPILER_INITIALIZER_LISTS
#      define Q_COMPILER_UNICODE_STRINGS
#      define Q_COMPILER_VARIADIC_TEMPLATES
#    endif
#    if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
       /* C++11 features supported in GCC 4.5: */
#      define Q_COMPILER_LAMBDA
#      define Q_COMPILER_RAW_STRINGS
#    endif


Further reference for MSVC 2010: 
http://blogs.msdn.com/b/vcblog/archive/2010/04/06/c-0x-core-language-features-in-vc10-the-table.aspx


Relevant features to evaluate for unconditional use:
- auto
- rvalue refs (without rvalue refs for *this)
- lambda
- override
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130718/4ae2e7dd/attachment.sig>


More information about the Kde-frameworks-devel mailing list