-
Notifications
You must be signed in to change notification settings - Fork 25
cppcheck lints - change a lot of method params to use const ref, etc etc #244
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
base: development
Are you sure you want to change the base?
cppcheck lints - change a lot of method params to use const ref, etc etc #244
Conversation
Also includes some error handling fixups in AudioMan, some grammar fixes, and whatnot else Code Improvement™
HeliumAnt
left a comment
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.
Mostly fine, just make it consistent. (Move semantics would technically be more universal, however that's only if the caller uses them and there's literally nothing in the project that would do that correctly)
I intentionally left/put pass-by-value & move code instead of const ref at these spots. A const ref there would unavoidably cause a clone/reallocation anyway, since those are all assignments or lead to mutation, (like module ID lookup lowercasing the string). Move semantics in these spots at least allow for possibility of avoiding a clone altogether, but aren't worse at all than const ref if the caller forgets to use move, except in visual inconsistency you pointed out. For cases like this, I wonder if there's a compiler lint or a static analyzer which would highlight all the missed opportunities for moves. Then it'll all be truly optimal lol |
|
For the record, I have to go sleep now; I'll fix the constness violation and whatnot else tomorrow lol ...at least the violation is not a very big deal since multiplayer is dead code anyway :v |
HeliumAnt
left a comment
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.
gonna say ok on the move, just one small thing in the zipped modules.
also int -> size_t uwu
cppcheck lints - change a lot of method params to use const ref, etc etc
|
meson update moment :D |
Ran
cppcheckon the codebase and cleaned up most lints that it outputs.The specific invocation I used:
(copy
compile_commands.jsonfrom build dir to root of the project first of course)Also includes some error handling fixups in AudioMan, some grammar fixes, and whatnot else Code Improvement™
bub fix 👍