From c2a2c4c819849f28d0bafd607116998a9a669773 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 1 Apr 2015 18:42:52 +0200 Subject: [PATCH] Coding guidelines: Add various C++11 features Change-Id: I9d3ca28bf8d5d04e04464757420a3c8e30f5dac0 Reviewed-by: Leena Miettinen Reviewed-by: Tobias Hunger --- doc/api/coding-style.qdoc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/api/coding-style.qdoc b/doc/api/coding-style.qdoc index 7d0fbb1e7ab..e3e2c6db22c 100644 --- a/doc/api/coding-style.qdoc +++ b/doc/api/coding-style.qdoc @@ -890,6 +890,35 @@ const QVector values = {1, 2, 3, 4, 5}; \endcode + \section3 Non-Static Data Member Initialization + + Use non-static data member initialization for trivial initializations, except in public + exported classes. + + \section3 Defaulted and Deleted Functions + + Consider using \c{=default} and \c{=delete} to control the special functions. + + \section3 Override + + It is recommended to use the \c{override} keyword when overriding virtual functions. Do not + use virtual on overridden functions. + + Make sure that a class uses \c{override} consistently, either for all overridden functions or + for none. + + \section3 Nullptr + + All compilers support \c{nullptr}, but there is no consensus on using it. If in doubt, ask + the maintainer of the module whether they prefer using \c{nullptr}. + + \section3 Range-Based for-Loop + + You may use range-based for-loops, but beware of the spurious detachment problem. + If the for-loop only reads the container and it is not obvious whether the + container is const or unshared, use \c{std::cref()} to ensure that the container + is not unnecessarily detached. + \section2 Using QObject \list