-
Notifications
You must be signed in to change notification settings - Fork 357
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 the codebase - overrides, nullptrs and redundant voids #2493
Conversation
I would advise against more complexity in this PR.
I tried
Our policy so far has been to fix this if there are other changes to the code. I would suggest to isolate this in a separate PR if we want to do it everywhere.
Do it in this PR where you make changes involving |
Sounds good, regarding no. 6, is there a good way of finding all occurrences of |
By the way, the MacOS check fails again without any errors, probably because of some warnings. These warnings are fixed in the other PR though, so I won't fix them here again. How should I handle this? |
First get #2493 merged, then merge master into this PR, which should solve the problem. I would generally suggest that you build your work on the branch for #2493, so that when #2493 is merged, the change set from this PR simply becomes smaller. |
I did already do that, actually. All changes here are completely additional to those in #2479 . I now also merged master into this and will now wait to see if all warnings are gone. |
I addressed no. 6 in PR #2496 to keep different types of changes strictly separated. #2496 is based on the changes of this PR, we should therefore merge this PR first and then review the other one. |
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.
Looks got to me, thank you! In the spirit of keeping PRs orthogonal, I think it is right to leave &&
and ||
in place here even in statements that are touched.
This PR acts as an addition to PR #2479. No new types of changes will be introduced by this PR, only missed cases of those discussed in the prequel-PR are added. These cover the following three types of issues:
nullptr
instead ofNULL
or0
to initialize empty pointers or to check for an undefined pointer.void
argument from function with empty argument lists.override
specifiers for overridden functions in derived classes and, if applicable, remove the redundantvirtual
specifier whenoverride
is set as well.There are a few possible other changes that could be included in this PR:
final
in models, as those will not be overridden any further. This is based on the assumption that models won't ever be based on another model (i.e., derive from another model). The final specifier is utilized by some compilers to increase performance of the compiled code. I have not seen any benchmarks yet that show how significant the performance increase can be, but even if performance is unaltered, marking a final function asfinal
would hurt nobody.&&
toand
as well as!
tonot
. We started doing this in Modernize the code base and make it more compliant to common C++ style guides #2479, and we should either do it everywhere or nowhere at all.if( ptr != nullptr )
toif ( ptr )
as both behave the same for all compilers that follow the C++ standard.