our_dick/doc/coding_standard.txt
2020-08-15 13:41:49 -07:00

83 lines
1.5 KiB
Plaintext

must do's:
general:
c++17 targetted standard
115 max line length
prefer // over /**/
format pointers as `char* thing;`
tabs not spaces
c++ casts
spaces around assignment, comparison, and arithmetic operators
spaces after semicolon in for loop
spaces after comma operator and after parameter commas
const wherever possible (const-correctness)
pass by pointer or by reference
prefer reference over pointer
keep implementation in source files with template and constexpr as exceptions
keep template/constexpr implementations in .tpp files alongside the .hpp files
prefer nullptr over NULL
functions:
50 max length
comments max 2 lines
no void in parameter list: void func(){}
brace formatting:
void function(void){
}
if(thing){
}else if(thing){
}else{
}
for(){
}
switch(case){
case 1:
break;
}
struct thing {
int thingy;
};
union thing {
int thingy;
};
class thing
{
private:
int thingy;
public:
void func(void);
};
enum thing{
stuff,
};
no-no's:
goto (except when breaking from inner loop)
for(){
for(){
goto breakinner;
}
}
breakinner:;
using c++ exceptions
using <iostream>
asm blocks
use of 'friend'
nested ternary
ternary outside of variable initialization
lambdas
malloc/free
#pragma
structured bindings
range based for loops
`class` in template parameter list
struct keyword before an object declaration
struct game_state* gl; //bad boi
excess include directives