https://www.slicer.org/w/index.php?title=Documentation/Labs/ModernizeC%2B%2B&feed=atom&action=historyDocumentation/Labs/ModernizeC++ - Revision history2024-03-29T13:07:11ZRevision history for this page on the wikiMediaWiki 1.33.0https://www.slicer.org/w/index.php?title=Documentation/Labs/ModernizeC%2B%2B&diff=61293&oldid=prevJChris.FillionR: Created page with " == Progress == * Available migration guide ** C++11: Update source code to use nullptr ** C++11: Update source..."2019-07-12T15:24:51Z<p>Created page with " == Progress == * Available <a href="/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide" title="Documentation/Nightly/Developers/Tutorials/MigrationGuide">migration guide</a> ** C++11: Update source code to use nullptr ** C++11: Update source..."</p>
<p><b>New page</b></p><div><br />
== Progress ==<br />
<br />
* Available [[Documentation/Nightly/Developers/Tutorials/MigrationGuide|migration guide]]<br />
** C++11: Update source code to use nullptr<br />
** C++11: Update source code to use override<br />
** C++11: Update source code to use = delete<br />
** C++11: Update source code to use = default<br />
<br />
* Slicer code base updates:<br />
** COMP: Update build system removing support for C++98/Qt4/VTK7<br />
** Replace ITK_NULLPTR, VTK_NULLPTR, NULL with nullptr<br />
** Replace VTK_OVERRIDE, ITK_OVERRIDE with override<br />
** COMP: Update minimum required CMAKE_OSX_DEPLOYMENT_TARGET to 10.11<br />
** STYLE: Modernize sources using override instead of virtual keyword<br />
** STYLE: Modernize: use delete for not implemented functions<br />
** r28037: STYLE: Modernize: use default for empty constructors<br />
<br />
== Modernize to c++11 ==<br />
<br />
'''The use of auto''' <br />
<br />
run-clang-tidy.py -checks=-*,modernize-use-auto -header-filter=.* -fix <br />
<br />
The automatic fix use auto in cases where static_cast is used:<br />
<br />
- int a = static_cast<int>(something);<br />
+ auto a = static_cast<int>(something);<br />
<br />
No much gain on this particular case, however, when using iterators and other verbose types, it really helps readability.<br />
<br />
The change should be discussed with the main developers to reach a consensus. VTK and ITK are using auto in a lot of cases.<br />
<br />
<br />
<br />
'''Move not implemented constructors and assignment operators to the public interface''' <br />
<br />
Now that we use = delete, we don't need the constructors and assignment operator to be in the private interface.<br />
Moving them to the public interface is better. Including better integrations with IDE's.<br />
<br />
<br />
'''Other modernizers'''<br />
clang-tidy --list-checks -checks='*' | grep "modernize"<br />
modernize-avoid-bind<br />
modernize-deprecated-headers<br />
modernize-loop-convert<br />
modernize-make-shared<br />
modernize-make-unique<br />
modernize-pass-by-value<br />
modernize-raw-string-literal<br />
modernize-redundant-void-arg<br />
modernize-replace-auto-ptr<br />
modernize-replace-random-shuffle<br />
modernize-return-braced-init-list<br />
modernize-shrink-to-fit<br />
modernize-unary-static-assert<br />
modernize-use-auto # ToDiscuss<br />
modernize-use-bool-literals<br />
modernize-use-default-member-init<br />
modernize-use-emplace # easy!<br />
modernize-use-equals-default # DONE<br />
modernize-use-equals-delete # DONE<br />
modernize-use-noexcept <br />
modernize-use-nullptr # DONE<br />
modernize-use-override # DONE<br />
modernize-use-transparent-functors<br />
modernize-use-uncaught-exceptions<br />
modernize-use-using # Better style, to discuss.<br />
<br />
Check https://github.com/InsightSoftwareConsortium/ITK/tree/master/Utilities/ITKv5Preparation for a list of commands used in the <br />
ITKv5 transition.</div>JChris.FillionR