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

UtilBase member functions do not need (some) parameters passed #9

Open
bjwyman opened this issue Mar 22, 2022 · 0 comments
Open

UtilBase member functions do not need (some) parameters passed #9

bjwyman opened this issue Mar 22, 2022 · 0 comments

Comments

@bjwyman
Copy link
Contributor

bjwyman commented Mar 22, 2022

From a code review: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-power/+/52148/2..4/phosphor-power-supply/power_supply.cpp#b178

@smccarney said:

There are a few issues with passing data members as parameters, such as:

  • Makes the code confusing. What is the value of parameter shortName vs. data member shortName? Why do both exist?
  • The parameter hides the data member in the method.

There are a few cases where it can make sense, but in general I think it is something to be avoided.

https://github.com/openbmc/phosphor-power/blob/master/phosphor-power-supply/util_base.hpp

https://github.com/openbmc/phosphor-power/blob/master/phosphor-power-supply/util.hpp

https://github.com/openbmc/phosphor-power/blob/master/phosphor-power-supply/test/mock.hpp

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

No branches or pull requests

1 participant