Closed ChristianTackeGSI closed 8 months ago
@ChristianTackeGSI,
why do you delete the forward declarations? The classes are used in the code, so in my opinion they belong there even if they come by chance via the include statement.
Most places use those classes in overriden methods. So that original declaration of that method must have the right declarations already. So those declarations do not come "by chance".
And in the examples, we should not use forward declarations of main FairRoot classes. We should use the correct #include
s in those cases: Users should learn to use correct includes and not forward declarations for FairRoot classes. For example we could switch classes to using
s with the exact same API. But usings and classes are not the same.
a subtle comment: don't default a destructor if it can be removed.
There is always a preference for "Rule of 0", which means no definition of any special member functions (destructor, move constructor, copy constructor, move assignment, copy assignment). If any of them need to be defined, they should be defined all together. (Rule of 5)
Thanks for your comments!
I think, the relevant one would rather be the "Rule of 5": At least the default constructor needs to be defined in these cases. So we probably should declare them all (even if only = default
ed, to be explicit).
So "being explicit" is the thing here. And I wanted to start with the desctructor that was already there.
Of course, this stuff could be moved into its own commit, maybe. Let me take another look.
Moved the override
and =default
into its own commit.
The updates across various files primarily involve copyright year adjustments and modernizing the class definitions within the C++ codebase. Key modifications include defaulting destructors and marking them as override
, transitioning from ClassDef
to ClassDefOverride
for class definitions, and explicitly marking certain methods as override
. These changes streamline the code and adhere to modern C++ best practices, ensuring consistency and clarity in the management of class inheritance and object destruction.
File Pattern | Change Summary |
---|---|
.../FairPassiveContFact.h, .../FairTutorialDet[1-4]ContFact.h, .../FairRutherfordContFact.h, .../NewDetectorContFact.h (across various paths), .../MyPassiveContFact.h (across various paths) |
- Copyright year updated - Destructor defaulted and marked as override - createContainer method marked as override - Transition from ClassDef to ClassDefOverride |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
and add some override, while in those files.
Checklist: