SJSURoboticsTeam / urc-central-2021

Track progress and information for the URC 2021 competition
MIT License
1 stars 0 forks source link

Add const keyword to accessor functions #242

Closed naterpotatoers closed 2 years ago

naterpotatoers commented 2 years ago

In Data Structures and Algorithm Analysis in C++ by Mark Allen Weiss he claims that accessor (getters) should be marked with the const keyword. Otherwise member functions are technically mutators by default. This is the same case for any locally scoped variables that shouldn't have its value updated as a best practice to prevent possible bugs

acarrou commented 2 years ago

In Data Structures and Algorithm Analysis in C++ by Mark Allen Weiss he claims that accessor (getters) should be marked with the const keyword. Otherwise member functions are technically mutators by default. This is the same case for any locally scoped variables that shouldn't have its value updated as a best practice to prevent possible bugs

ah interesting, never thought of this but sounds like it's a good way to avoid bugs!

Coreyboy1820 commented 2 years ago

Looking into this now.

Coreyboy1820 commented 2 years ago

Done for arm, just have to get someone to do it for drive.

acarrou commented 2 years ago

I can do it when I get back on in the morning

acarrou commented 2 years ago

Done for arm, just have to get someone to do it for drive.

Maybe we also do it for the rover_arm_system.hpp file?

naterpotatoers commented 2 years ago

done