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

correctedP4 must return a copy of p4() #11311

Merged
merged 1 commit into from Sep 22, 2015

Commits on Sep 17, 2015

  1. correctedP4 must return a copy of p4()

    `correctedJet()` returns a new `Jet` object. In `correctedP4()` we
    return a reference to p4() on a stack, thus the reference is invalid and
    most likely value will be changed with the next few function calls.
    
        DataFormats/PatCandidates/interface/Jet.h:155:178: error: function
        returns address of local variable [-Werror=return-local-addr]
        DataFormats/PatCandidates/interface/Jet.h:158:204: error: function
        returns address of local variable [-Werror=return-local-addr]
    
    A quick fix (this patch) is to make `correctedP4()` return a copy
    instead of a reference.
    
    If `correctedJet()` is on hot path, the new `Jet` object should be
    cached and then we could also return a reference in `correctedP4()`.
    
    Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
    David Abdurachmanov authored and David Abdurachmanov committed Sep 17, 2015
    Configuration menu
    Copy the full SHA
    40b6690 View commit details
    Browse the repository at this point in the history