Difference between revisions of "Documentation/Labs/ModernizeC++"
(Created page with " == Progress == * Available migration guide ** C++11: Update source code to use nullptr ** C++11: Update source...")
Latest revision as of 11:24, 12 July 2019Home < Documentation < Labs < ModernizeC++
- Available migration guide
- C++11: Update source code to use nullptr
- C++11: Update source code to use override
- C++11: Update source code to use = delete
- C++11: Update source code to use = default
- Slicer code base updates:
- COMP: Update build system removing support for C++98/Qt4/VTK7
- Replace ITK_NULLPTR, VTK_NULLPTR, NULL with nullptr
- Replace VTK_OVERRIDE, ITK_OVERRIDE with override
- COMP: Update minimum required CMAKE_OSX_DEPLOYMENT_TARGET to 10.11
- STYLE: Modernize sources using override instead of virtual keyword
- STYLE: Modernize: use delete for not implemented functions
- r28037: STYLE: Modernize: use default for empty constructors
Modernize to c++11
The use of auto
run-clang-tidy.py -checks=-*,modernize-use-auto -header-filter=.* -fix
The automatic fix use auto in cases where static_cast is used:
- int a = static_cast<int>(something); + auto a = static_cast<int>(something);
No much gain on this particular case, however, when using iterators and other verbose types, it really helps readability.
The change should be discussed with the main developers to reach a consensus. VTK and ITK are using auto in a lot of cases.
Move not implemented constructors and assignment operators to the public interface
Now that we use = delete, we don't need the constructors and assignment operator to be in the private interface. Moving them to the public interface is better. Including better integrations with IDE's.
clang-tidy --list-checks -checks='*' | grep "modernize" modernize-avoid-bind modernize-deprecated-headers modernize-loop-convert modernize-make-shared modernize-make-unique modernize-pass-by-value modernize-raw-string-literal modernize-redundant-void-arg modernize-replace-auto-ptr modernize-replace-random-shuffle modernize-return-braced-init-list modernize-shrink-to-fit modernize-unary-static-assert modernize-use-auto # ToDiscuss modernize-use-bool-literals modernize-use-default-member-init modernize-use-emplace # easy! modernize-use-equals-default # DONE modernize-use-equals-delete # DONE modernize-use-noexcept modernize-use-nullptr # DONE modernize-use-override # DONE modernize-use-transparent-functors modernize-use-uncaught-exceptions modernize-use-using # Better style, to discuss.
Check https://github.com/InsightSoftwareConsortium/ITK/tree/master/Utilities/ITKv5Preparation for a list of commands used in the ITKv5 transition.