Remove duplicated non-virtual base-class method#3327
Merged
andypugh merged 1 commit intoLinuxCNC:masterfrom Feb 6, 2025
Merged
Remove duplicated non-virtual base-class method#3327andypugh merged 1 commit intoLinuxCNC:masterfrom
andypugh merged 1 commit intoLinuxCNC:masterfrom
Conversation
Collaborator
|
It looks like it exists to trap improper usage? All it does is say "you shouldn't have called me". |
Contributor
Author
|
And that is exactly why it is pointless. Therefore, if you don't want this base-class method to get called, ever, then you simply don't include it in the base (!) class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A non-virtual method cannot be "properly" overloaded. It is also a pointless construct because the base-class method claims it should never be called. Therefore, it should not exists at all, resulting in it never being called (and the compiler will error if you try).
This particular method cannot be made virtual because of the vtable, which cannot be located in shared memory (pointers are not valid across shmem maps). Anyway, there is no point in having it at all in the base-class. Derived classes must declare and define it where necessary.
Cppcheck found this issue [duplInheritedMember] and this PR is the first part of fixing the this problem class. This PR roughly halves the reported instances of the warning.