Updated style guide to reflect modified style

This commit is contained in:
ridiculousfish 2012-11-18 16:30:53 -08:00
parent 9992b8eb0e
commit 9b52269a5b

View file

@ -6,29 +6,33 @@ style.
## Formatting ## Formatting
1. Always use 2 spaces instead tabs as indent (unless needed like `Makefile`). 1. fish uses the Allman/BSD style of indentation.
2. Opening curly bracket is always the same line as declaration. 2. Indent with spaces, not tabs.
3. Use 4 spaces per indent (unless needed like `Makefile`).
4. Opening curly bracket is on the following line:
// ✔: // ✔:
struct name { struct name
{
// code // code
}; };
void func() {
// code
}
if (...) {
// code
}
// ✗:
void func() void func()
{ {
// code // code
} }
3. Put space after `if`, `while` and `for` before conditions. if (...)
{
// code
}
// ✗:
void func() {
// code
}
5. Put space after `if`, `while` and `for` before conditions.
// ✔: // ✔:
if () {} if () {}
@ -36,7 +40,7 @@ style.
// ✗: // ✗:
if() {} if() {}
4. Put spaces before and after operators excluding increment and decrement; 6. Put spaces before and after operators excluding increment and decrement;
// ✔: // ✔:
int a = 1 + 2 * 3; int a = 1 + 2 * 3;
@ -46,7 +50,7 @@ style.
int a=1+2*3; int a=1+2*3;
a ++; a ++;
5. Never put spaces between function name and parameters list. 7. Never put spaces between function name and parameters list.
// ✔: // ✔:
func(args); func(args);
@ -54,8 +58,8 @@ style.
// ✗: // ✗:
func (args); func (args);
6. Never put spaces after `(` and before `)`. 8. Never put spaces after `(` and before `)`.
7. Always put space after comma and semicolon. 9. Always put space after comma and semicolon.
// ✔: // ✔:
func(arg1, arg2); func(arg1, arg2);
@ -71,7 +75,7 @@ style.
Document your code using [Doxygen][dox]. Document your code using [Doxygen][dox].
1. Documentation comment should use double star notation or tipple slash: 1. Documentation comment should use double star notation or tripple slash:
// ✔: // ✔:
/// Some var /// Some var