-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
Joël R. Langlois edited this page Jan 12, 2026
·
10 revisions
Though your code should be relatively self-documenting, at least document all of your complex functions. Jumping into a well documented application codebase and library is helpful and appreciated, especially when the flow is new or simply not obvious!
Use Doxygen for header documentation.
For implementation file documentation (eg: in .cpp and .mm files), use basic comments to explain a complex or non-obvious piece of code.
- Use two asterisks to delineate the beginning of a class, function, method or variable comment.
- Use Javadoc-style.
- Use the
@symbol for commands.
- Use the
- Only one space must follow the
/**. - The initial sentence must be a summary of the intent (an implied
@brief), or a well described intent in and of itself. - This summary must be written in normal sentence case and end with a period.
- The summary must be written on the same line as the
/**. - If the comment is easy to read on one line, put it on one line!
- Otherwise, if the comment spans multiple lines, the closing
*/must be on its own line. - Use simple newlines for separator lines.
- Do not use a symbol to represent the beginning of a new line!
/** Does stuff and things.
This function is very important for... reasons.
*/
void foo();/** A double-precision floating point representation of pi.
@see https://en.wikipedia.org/wiki/Pi
*/
static const double pi = 3.141592654;/** @see https://www.google.ca */
void bar();Do not redundantly specify default commands.
For example, do this to automatically make use of @brief and @details:
/** Does stuff and things
Does an important bunch of stuff and things.
*/
void foo();Do not specify the following commands, unless there's something legal telling you otherwise (use your best judgement!):
Only use these commands in your code:
-
@internal- Only when overriding a method.
-
@codeand@endcodeto show examples. -
@paramto describe parameters. -
@param[in]to describe inputted parameters. -
@param[out]to describe outputted parameters. -
@returnor@returnsto describe the purpose behind the returned value or object. -
@see- To point to other pieces code, like methods or variables.
- To point to web URLs.
@bug@warning