-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Remove unnecessary const modifiers from function parameters #80633
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-requesting reviews from non-collaborators: @wapcaplet @andrei8l
|
I wouldn't call them unnecessary. Although it's not strictly enforced there is a mild preference to use |
|
@akrieger I agree with part of what you said. According to Cpp Core Guidelines, local variables should be declared with const, but function parameters might be an exception. To maintain consistency in the code style, most of the parameters passed by value in this project are not declared with const. This is to ensure uniformity and simplify the code.
|
|
I'm aware that We don't explicitly follow any external style guides nor do we automatically consider their suggestions as meaningful to consider just because of the source. We have project local conventions we follow and consider each on a case by case basis. |
|
This PR was simply made to maintain consistency with the code style of other parts of the same project. The Cpp Core Guidelines are just an example. |
Summary
None
Purpose of change
Parameters passed by value do not need the
constmodifier, which simplifies the code and maintains a more consistent coding style.Describe the solution
Describe alternatives you've considered
Testing
Additional context