DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
There are many different coding styles (indentation, formating, naming conventions) used in the yts Traffic Server code base and can sometimes distracting. It is best to agree on one standard even if having to compromise on a style you have become to accustomed to.
...
| Code Block |
|---|
#include <iostream> using namespace std; namespace ytsts { /** * @brief Demonstrates how to format code * This class demonstrates to developers how we should structure code */ class Counter { public: Counter():_count(0), _totalCount(0) { } /** * @brief Increments the count by one or an optional value * @param delta The amount to increment the count, default is 1 */ void increment(int delta = 1) { _count += delta; } /** * @brief Returns the count value * @return Count value */ int getCount() const { // try to use const as much as possible return _count; } private: // try to hide data int _count; /// if there is something special to say int _totalCount; }; } /** * @brief This is the main function for the program */ int main() { ytsts::Counter x; if (x.getCount() == 0) { x.increment(); } else { // make sure to always use braces for conditionals } // increment the counter 10 times for (int i = 0; i < 10; ++i) { x.increment(); } cout << x.getCount() << endl; } |
...
TODO comments
Example of comment TODO:<verbatim class="example">
| Code Block |
|---|
// TODO handle case for negative config value |
...
|
Notice the format:
- the TODO is all capitalized
- first letter of TODO message does not need to be upper-case
- there is no colon or dash char after TODO
- there is no period at the end
- description is short (70 chars or less if possible) and helpful
- the TODO message describes an action that needs to be performed in the future