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
STYLE: Add in-class {}
initializers to classes with virtual functions
#3913
STYLE: Add in-class {}
initializers to classes with virtual functions
#3913
Conversation
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.
How did you find all these classes?
My script (in C++): https://gist.github.com/N-Dekker/738d28b8d7528a32c12e7a129160b00f It looks for a line of code that start with |
Should this script be added to the repository? |
Maybe, but I don't want to maintain the script forever. Should the script itself then need to conform to the ITK coding guidelines? |
I don't think so. It is a repository of scripts which were used once upon a time, and are therefore good starting points if you need the same thing again. You should add a short usage in the comments at the top of the script, so a future you/me/somebody else can make sense of what the script is for and how to invoke it. |
Added in-class `{}` default member initializers to data members of classes that have one or more virtual member functions. For an object that has one or more virtual member functions, the performance cost of adding a `{}` default member initializer to each of its non-static data members should be acceptable, relative to cost of the initialization of its virtual table. Follow-up to pull request InsightSoftwareConsortium#3851 commit 5e2c49f "STYLE: Add in-class `{}` member initializers to objects created by New()" (which only looked at classes that have a `itkNewMacro`).
29374db
to
6ba4e1d
Compare
FYI, The force-push that I just did has included classes that have an |
|
Thanks for your approval, @dzenanz One of the concerns I have about adding the script to github.com/InsightSoftwareConsortium/ITK.git is that it would trigger another CI run with each revision. Which seems like a waste of energy to me, because the CI does not test the script at all. Would it be possible for the CI to bypass changes in ITK/Utilities/Maintenance ? |
I don't know whether it is possible to run the CI conditionally (I don't think it is), and if so how to do it. |
Oh wait, I see now at https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/trigger?view=azure-pipelines#trigger-batch-branches-paths-tags
So it seems possible to exclude "README.md" from the CI trigger. Then also any other file, I guess. |
You could give it a try, exclude |
Added in-class `{}` default member initializers to data members of classes that have a destructor declared `override = default`. Follow-up to pull request InsightSoftwareConsortium#3913 commit 5c97b76 "STYLE: Add in-class `{}` initializers to classes with virtual functions"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default" pull request InsightSoftwareConsortium#3941 "STYLE: Add in-class `{}` member initializers to 3-letter data members"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default" pull request InsightSoftwareConsortium#3941 "STYLE: Add in-class `{}` member initializers to 3-letter data members" pull request InsightSoftwareConsortium#3945 "STYLE: Add in-class `{}` member initializers having trailing comments"
The script that was used for the following pull requests: pull request InsightSoftwareConsortium#3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request InsightSoftwareConsortium#3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request InsightSoftwareConsortium#3917 "STYLE: Add in-class `{}` initializers to classes with override = default" pull request InsightSoftwareConsortium#3941 "STYLE: Add in-class `{}` member initializers to 3-letter data members" pull request InsightSoftwareConsortium#3945 "STYLE: Add in-class `{}` member initializers having trailing comments"
The script that was used for the following pull requests: pull request #3851 "STYLE: Add in-class `{}` member initializers to objects created by New()" pull request #3913 "STYLE: Add in-class `{}` initializers to classes with virtual functions" pull request #3917 "STYLE: Add in-class `{}` initializers to classes with override = default" pull request #3941 "STYLE: Add in-class `{}` member initializers to 3-letter data members" pull request #3945 "STYLE: Add in-class `{}` member initializers having trailing comments"
Added in-class
{}
default member initializers to data members of classes that have one or more virtual member functions.For an object that has one or more virtual member functions, the performance cost of adding a
{}
default member initializer to each of its non-static data members should be acceptable, relative to cost of the initialization of its virtual table.Follow-up to pull request #3851 commit 5e2c49f "STYLE: Add in-class
{}
member initializers to objects created by New()"