-
Notifications
You must be signed in to change notification settings - Fork 98
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
Fail test when calling function twice #1196
Conversation
Change the Initialize function such that it asserts when the function is called twice.
fIsInitialised = kTRUE; | ||
/* | ||
FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb(); | ||
FairTutorialDet1GeoPar* par=(FairTutorialDet1GeoPar*)(rtdb->getContainer("FairTutorialDet1GeoPar")); |
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.
Maybe remove the commented code while you're changing this anyway?
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.
Some ideas. Can be merged as is, if you don't like those ideas.
@@ -95,6 +95,8 @@ class FairTutorialDet1 : public FairDetector | |||
Double32_t fLength; //! length | |||
Double32_t fELoss; //! energy loss | |||
|
|||
Bool_t fIsInitialised; //! prevent double initilization |
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.
Bool_t fIsInitialised; //! prevent double initilization | |
bool fIsInitialised{false}; //!< prevent double initilization |
Some ideas:
- Let's use plain C++ types (
bool
) - member initaliser?
- Doxygen compatible comment
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.
the ideas are fine but I would prefer to move the PR as is.
I also thought about them but in my opinion this should be done in separate pull requests which move the code to more modern C++.
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.
Then go ahead and merge this one!
Change the Initialize function such that it asserts when the function is
called twice.
Closes #1195
Checklist:
dev
branch