Navigation Menu

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

Fixing gcc491 compilation #5676

Merged
merged 1 commit into from Oct 7, 2014

Conversation

rappoccio
Copy link
Contributor

Fixing signed to unsigned comparison error for gcc 4.9.1.

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 3, 2014

A new Pull Request was created by @rappoccio for CMSSW_7_3_X.

Fixing gcc491 compilation

It involves the following packages:

CommonTools/RecoAlgos

@cmsbuild, @nclopezo, @StoyanStoynev, @slava77 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.
@nclopezo, @ktf you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

@StoyanStoynev
Copy link
Contributor

@cmsbuild test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2014

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2014

@StoyanStoynev
Copy link
Contributor

@rappoccio I am just wondering why "static_cast(matched_index)" is preferred to "(unsigned int) matched_index" in this case.

@davidlt
Copy link
Contributor

davidlt commented Oct 4, 2014

Because it's C++ and _cast functions are well defined comparing to C type casts/conversions. Read: http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Casting Avoid mixing C and C++ too much.

@StoyanStoynev
Copy link
Contributor

+1
For 140417a . Based on jenkins, no effect on RECO.
It was not an objection but for int to unsigned int I would certainly prefer the C-style in this trivial case.

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2014

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_3_X IBs unless changes (tests are also fine). @nclopezo, @ktf can you please take care of it?

@davidlt
Copy link
Contributor

davidlt commented Oct 4, 2014

It probably should be static_cast<size_t>, I assume that size() returns a type of size_t (e.g. std containers).

@Dr15Jones
Copy link
Contributor

I very strongly agree with David. We should avoid C style casts in CMSSW.

@slava77
Copy link
Contributor

slava77 commented Oct 7, 2014

why is this one still open and not merged?

ktf added a commit that referenced this pull request Oct 7, 2014
@ktf ktf merged commit 1e0970d into cms-sw:CMSSW_7_3_X Oct 7, 2014
@davidlange6
Copy link
Contributor

did we address the comments of David/Chris?

On Oct 7, 2014, at 11:57 AM, Slava Krutelyov notifications@github.com
wrote:

why is this one still open and not merged?


Reply to this email directly or view it on GitHub.

@slava77
Copy link
Contributor

slava77 commented Oct 7, 2014

The comment from David/Chris was essentially just confirming that the fix here is done correctly (using c++ cast). So, no action was needed.

@slava77
Copy link
Contributor

slava77 commented Oct 7, 2014

... except that size_t was not applied

@davidlt
Copy link
Contributor

davidlt commented Oct 7, 2014

@slava77 I would like to get size_t in, because size_t has different sizes on 32-bit and 64-bit systems. Let's play safe.

@slava77
Copy link
Contributor

slava77 commented Oct 7, 2014

Sal, could you please make a change (possibly a separate branch)

David,
I guess we have hundreds of places with unsigned int used instead of size_t.
Is there a way to keep track of this with a compiler/analyzer?

@davidlt
Copy link
Contributor

davidlt commented Oct 7, 2014

@slava77 UBSan can detect this kind of issues, but only the one already happening. Clang Static Analyzer maybe could do so, also maybe some compiler flags. I don't know concrete answer.

@rappoccio
Copy link
Contributor Author

OK I just pushed another change to this branch to make it a "size_t", but I don't see it registering because this is closed. I will make another PR.

@rappoccio
Copy link
Contributor Author

New PR #5728

@StoyanStoynev StoyanStoynev mentioned this pull request Oct 8, 2014
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

8 participants