This repository was archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Coding Conventions
Ryan Peach edited this page Nov 5, 2015
·
3 revisions
#C++ Headers
- .cpp Files should only include a reference to its header.
- The header is where all #include and namespace declarations should be made.
- The header should always be protected using the following convention:
#ifndef FILENAME
#define FILENAME
code ...
#endif
- The header is where all method documentation is stored (unnecessary in the .cpp file)
- Small methods extending from a larger method may be declared in the header file (Preferably one-liners).
- Only one doccumentation comment is necessary per group of related methods.
- Groups of related methods ought to not be separated by whitespace.
- Different groups ought to be separated by double whitespace.
#Commenting We use tags in order to make our comments more data-centric for future automatic documentation. The following tags are most common:
- @Param
- @Return
- @Complexity
We do not use the tags @author and @date for several reasons:
- These tags are rarely remembered when writing and updating code
- We use a VCS which keeps track of all of this information automatically.
##Files All files should have a header containing of the following format:
/**
* <Filename.type>
* <Description>
*/
##Methods All methods should have a header containing of the following format:
/**
* <Description>
*
* @Param Param1: <Description>
* @Param Param2: <Description>
* @Param ...
* @Return <Regular condition>
* @Return <Exception condition>
* @Return ...
* @Complexity <Min Complexity>, <Average Complexity>, <Max Complexity>
*/
ALWAYS include an exception-condition if one exists.