Skip to content

Conversation

@mt82
Copy link

@mt82 mt82 commented Oct 27, 2025

Added a initialization value to the parent member of TrueParticle

@mt82 mt82 linked an issue Oct 27, 2025 that may be closed by this pull request
@mt82 mt82 requested a review from PetrilloAtWork October 27, 2025 13:23
Copy link
Member

@PetrilloAtWork PetrilloAtWork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what? This type of mistakes is being hunting us since forever, and I am electing you as the victim who's going to pay for it.

Please change the header code removing the constructors and placing all the initialisation in the line the data member is declared.
For example:

struct WireInfo {
    uint16_t wire = uint16_t(-1); //!< Wire number
    uint16_t plane = uint16_t(-1); //!< Plane number
    uint16_t tpc = uint16_t(-1); //!< TPC number
    uint16_t channel = uint16_t(-1); //!< Channel number
    int16_t tdc0 = -1; //!< TDC tick of the first ADC value
    std::vector<short> adcs; //!< List of ADC values
  };

And guess what? in doing this example I already caught two mistakes (the construction value for tdc0 was cast to uint16_t even if the variable is signed, int16_t; and channel was not initialised).
This is not new rule: [CF-155]. The idea is that when a person adds a variable in the list they're more likely to notice that all other are being initialised, and do the same for the new one.

If you don't feel like doing that, let me know and I'll add the commit to this branch.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parent member of TrueParticle not initialized

3 participants