-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize code to use override
#2728
Modernize code to use override
#2728
Conversation
Nice! Please rebase on the latest master, hopefully the Ubuntu job will not fail anymore. |
Please don't mark destructors of derived classes as |
Ok, I will remove them from destructors. I currently just wait for another run of clang-tidy, because last run was without CUDA. I hope I have now all projects enabled (except optronic_viewer #2701) |
4d47d44
to
1aa09e2
Compare
Integrated new run of clang-tidy and reverted changes to destructors. //Edit: Changes to destructors done via Regex |
@taketwo I looked into the link and it doesn't really explain why we shouldn't mark destructors of derived classes as override. Can you explain why? I marked destructors of derived classes as override for all of my projects... |
@jasjuang here is a related discussion: isocpp/CppCoreGuidelines#721. There are arguments in both directions, but in the end I'd stick with what the Core Guidelines recommend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good. Though I'd ask you to revert changes to the 3rdparty code that is bundled with PCL:
- recognition/include/pcl/recognition/3rdparty/metslib
- surface/include/pcl/surface/3rdparty/opennurbs
- surface/src/3rdparty/opennurbs/
Changes are done by: run-clang-tidy -header-filter='.*' -checks='-*,modernize-use-override' -fix Changes to destructors are reverted
5007869
to
99362da
Compare
Created a new commit with your requested changes included, because after last rebase GitHub displayed a wrong overview which files were changed (showed diff regarding changed whitespaces in CMakeLists of my last PR merged into master). |
@taketwo I spent some time going through the discussions I still don't see why we shouldn't mark destructors of the derived classes as override. It prevents bug like someone forgetting to make the destructors of the base class virtual, and the only argument against it seems to be the |
There exists a compiler warning ( In general: I don't have really a opinion about this. So it is for me a decision of the maintainers of this project. Just in case there will be added an additional check with clang-tidy on Azure we should add override to destructors, so we can check for missing overrides in non-destructor methods. //Edit: |
@jasjuang I don't have a very strong opinion here. I just thought it's a good idea to follow the guidelines endorsed by the C++ standardization committee. I agree with you though that there is value in marking them as @SunBlack Adding Ubuntu 18.04 based build is somewhere on my TODO list. And yes, for variety, we can use Clang there. |
override
Changes are done by:
run-clang-tidy -header-filter='.*' -checks='-*,modernize-use-override' -fix