-
Notifications
You must be signed in to change notification settings - Fork 0
code_style
The following sections detail the standards that all code should be adhering to. Please attempt to follow all style and coding conventions in your packages in order to allow smooth integration of your code into the master repository. Following these conventions will also make it easier for others on the team to read your code and quickly understand it.
The order of preference to greatest to least for the C++ Style conventions is as follows:
- This document
- ROS C++ Style Guide
- Google C++ Style Guide
In otherwords if there is a conflict in any of the documents use the rule in the document with the lowest number.
The order of preference to greatest to least for the C++ Style conventions is as follows:
- This document
- ROS Python Style Guide
- Python PEP 8
In otherwords if there is a conflict in any of the documents use the rule in the document with the lowest number.
Readability should be the number 1 priority in almost all cases. Some exceptions include when profiling has shown that optimizations must be done in order to get the desired performance from a section of code. Most of the time the compiler will do a good job of optimizing readable code by itself.
If you are concerned about performance you can profile your code using tools such as valgrind. See the Profiling section of this wiki for more info.
Code should have doxygen comments. See the Documentation section of this wiki for more info.
When writing code keep in mind the ease of testing. Try to write code so that unit tests and integration tests can easily be written. For more information on testing see the Testing section of this wiki for more info.