-
Notifications
You must be signed in to change notification settings - Fork 1
CPP Programming
For consistency with FRC library software, we utilize the same C++ conventions:
Type of name | Naming Rule | Examples |
---|---|---|
Class name | Initial capital CamelCase1. Acronyms all-caps. |
Robot , PWM
|
Method name | Initial capital CamelCase. |
StartCompetition ,DoWork
|
Member variable |
m_ followed by member variable name,initial lower CamelCase. |
m_deleteSpeedControllers |
Local variable | Initial lower CamelCase | targetAngle |
Constant |
k followed by constant name,initial capital CamelCase. |
kMaxServoAngle |
Macro | All caps, spaced with _ . |
DISALLOW_COPY_AND_ASSIGN |
All code shall be written in Kernaghan & Ritchie style, utilizing the built-in default formatter in Eclipse.
/*
* A sample source file for the code formatter preview
*/
#include <math.h>
class Point {
public:
Point(double x, double y) :
x(x), y(y) {
}
double distance(const Point& other) const;
double x;
double y;
};
double Point::distance(const Point& other) const {
double dx = x - other.x;
double dy = y - other.y;
return sqrt(dx * dx + dy * dy);
}
Make sure that K&R formatting is selected under Window > Preferences
.
To get the automatic formatter to clean up a section of code, just select the lines you want tidied, then go to Source > Format
. Alternatively, you can use the keyboard shortcut CTRL-Shift-F.
- History of git - http://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git
- Definition of Versioning - http://searchsoftwarequality.techtarget.com/definition/versioning
- The 'Git Bible' - http://git-scm.com/doc
- Merge v. Rebase - link 1, link 2, link 3
- FRC Robotics Official Site - http://www.usfirst.org/roboticsprograms/frc
Home
C++ Programming
C++ conventions
Code formatting
Choosing Your IDE
WindRiver
Eclipse
Basic Programming
SmartDashboard
UltraSonic Sensor
Git & GitHub
What is Git and GitHub?
Getting Started
Accounts
Making an Account
Get added to Raven's Robotics
Pre-Made Ravens Accounts
Creating a Repository
Cloning a Repository
Git Operations
Commits
Getting Updated Code
Fetch
Pull
Troubleshooting
Submitting New Code
Push
Learn more about Git
Automatic documentation
Comments
Tags
Windows installation
Ubuntu Linux installation
Eclox plugin
Installation
Use