-
Notifications
You must be signed in to change notification settings - Fork 4.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
make file var shape_ const since it is only read #2413
make file var shape_ const since it is only read #2413
Conversation
A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_7_1_X. make file var shape_ const since it is only read It involves the following packages: CondFormats/CastorObjects @apfeiffer1, @diguida, @cmsbuild, @nclopezo, @rcastello, @ggovi, @Degano can you please review it and eventually sign? Thanks. |
+1 |
Bypassing AlCa signature. Complain if not ok. The day we will allow |
…s-work Misc fixes -- Make file var shape_ const since it is only read
+1 |
ahhhgggg |
It has global storage so it is flagged per @Dr15Jones requirements: |
I am not aging about thread safety, |
Hi!
and the class interface does not modify it. |
yes, I think you are right. |
Making shape_ static const class member gives compilation errors. const CastorQIEShape& getShape () const { return shape_;} nm -C ~/CMSSW_7_1_0_pre2/lib/slc5_amd64_gcc481/libCondFormatsCastorObjects.so | grep shape_ |
OK, Chris showed me how to initialize a static const member correctly in the .cc file and nm shows only one symbol: nm -C ~/CMSSW_7_1_0_pre2/lib/slc5_amd64_gcc481/libCondFormatsCastorObjects.so | grep shape_ I will submit a pull request for this change. |
and no "guard variable" (used to make the function static construction thread safe) |
Thanks! |
File vars need to be const qualified when possible for thread safety. Once instantiated this never gets modified in production.