Coding style guidelines
Code
Due to many reasons ASL’s coding style in its current form is not always consistent. We work to improve this over time. Newly submitted code must follow the coding style guidelines below.
- No line of code exceeds 80 characters in length.
- Tabs are used for indentation. No spaces.
- The name of a class/function/variable clearly reflects its purpose.
- CamelCase in compound variable names.
- {} blocks - ANSI/Allman block style:
if ()
{
a = b;
}
else
{
a = b;
}
int functionName()
{
a = b;
}
- No space after function names, one space after if, for and while
- Boolean flags: isWritable, isReadable, etc..
- Member function’s arguments names the same as class members’ names, but with ‘_’ at the end:
function(int size_);
. - Two blank lines between function implementations.
Documentation
Comments
- Comments using doxygen style.
Markdown
- use ‘-‘ and ‘_’ instead of ‘+’, ‘*’.
- ’#’, ‘##’ instead of ‘======’, ‘——’.
- ’```’ for fenced code blocks.