79 lines
1.3 KiB
Plaintext
79 lines
1.3 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
|
|
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
|