Skip to content
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 static a const in SiStripFecCabling::fecs() #1532

Merged
merged 1 commit into from Nov 24, 2013

Conversation

davidlt
Copy link
Contributor

@davidlt davidlt commented Nov 20, 2013

I believe here is a problem of pointer/reference. People try to code in C++, but with C in mind. They want to return a const reference, but reference must point to a valid object, there is no such thing as null reference (not allowed by standard). To overcome the issue people started to define dummy statics inside the functions and return a reference to the dummy. It's wrong. The function should return a pointer and callee should return nullptr if needed. The caller cannot even handle situation if it gets a reference, it doesn't know if returned reference is valid or not.

Silences Clang Static Analyzer warning.

Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
@cmsbuild
Copy link
Contributor

A new Pull Request was created by @davidlt for CMSSW_7_0_X.

Make static a const in SiStripFecCabling::fecs()

It involves the following packages:

CalibFormats/SiStripObjects

@demattia, @cmsbuild, @nclopezo, @rcastello can you please review it and eventually sign? Thanks.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
@ktf you are the release manager for this.

@cmsbuild
Copy link
Contributor

ktf added a commit that referenced this pull request Nov 24, 2013
…ng.h

Multithreading fixes -- Make static a const in SiStripFecCabling::fecs()
@ktf ktf merged commit 2345875 into cms-sw:CMSSW_7_0_X Nov 24, 2013
@ktf
Copy link
Contributor

ktf commented Nov 24, 2013

Bypassing AlCa signature. @rcastello, @demattia complain if not ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants