-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[hist] Make abstract TH1,2,3 methods truly abstract and add missing implementations #17480
Conversation
b580a25
to
13cf518
Compare
The TH1K class implementation forgot to implement some abstract methods from the TH1 class that need to be implemented. As the TH1K is almost identical to TH1F (besides the KDE algorithm in the bin lookup), the TH1F implementations are copy-pasted.
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 awesome, thanks.
Not sure if this change might break user code in some situations but thery were already getting a warning before so I'm up for it.
Is there a plan to replace "AbstracMethod strings" in other Root classes into pure virtuals? Such as in Tunixsystem etc?
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 like a clear improvement to me, thanks! One small comment for consideration
It might break user code and it might not have been noticed before. The case is a class derived from TH1 where they both only overloaded a subset of the function and only use the overloaded functions. |
Test Results 18 files 18 suites 4d 4h 1m 28s ⏱️ For more details on these failures, see this check. Results for commit 5e8667c. |
@ferdymercury, no. I just did it it this PR because I was doing it locally anyway to hunt for the cases where these methods were not overridden. There are maybe other cases like that though! But I guess sometimes it's actually better than a "dummy override" in case you actually don't want to implement the method.
@pcanal, I can't see why anyone would like to do that, but of course you are right to point out this corner case. But does that mean you are against the suggested changes? It's not clear to me if you only made a note or requesting changes. Personally I think this corner case is so obscure that we don't need to consider it. |
Like this, it is not possible anymore to forget overriding these abstract methods.
@guitargeek My comments was a general one and making a point that we can not "blindly" replace all the In this case, I agree with the change as |
@pcanal, thanks for clarifying! |
@guitargeek Is it possible that this change produced a regression?
works on 6.34.02 but fails on master. (We should add a test, too). |
Yes possible! I forgot some "using" statements. |
The TH1K class implementation forgot to implement some abstract methods
from the TH1 class that need to be implemented.
As the TH1K is almost identical to TH1F (besides the KDE algorithm in
the bin lookup), the TH1F implementations are copy-pasted.
The incomplete implementation was noticed thanks to the test in #17399.
To make sure that these mistakes can't happen anymore, the virtual methods of
TH1
are made truly virtual in the sense of the C++ language standard. So far, the implementation was only telling you at runtime that the method should be overridden.