minor fixes
This commit is contained in:
parent
90cc749f4c
commit
90cbcd341d
@ -1,4 +1,4 @@
|
||||
// ### Compialation ###
|
||||
### Compialation ###
|
||||
+ remove all warnings
|
||||
clang -Weverything
|
||||
gcc -Wall -Wextra -Wpedantic
|
||||
@ -7,46 +7,45 @@
|
||||
+ GNU Make ok, that other Make with a prefix shall burn in hell
|
||||
+ NOTE: (to Xolatile in particular) fuck splint
|
||||
|
||||
// ### Including ###
|
||||
+ never use relative paths, manipulate the compiler
|
||||
### Multi-line comments ###
|
||||
+ single line for separating logical blocks inside the same block
|
||||
+ multiline for exaplaining code
|
||||
/\* stuff
|
||||
\* and more
|
||||
\*/
|
||||
+ use them very sparsely
|
||||
|
||||
// ### Multi-line comments ###
|
||||
+ single line for separating logical blocks inside the same block
|
||||
+ multiline for exaplaining code
|
||||
/* stuff
|
||||
* and more
|
||||
*/
|
||||
+ use them very sparsely
|
||||
### Headers ###
|
||||
+ never use relative paths, manipulate the compiler
|
||||
+ use #define type header guards
|
||||
+ header guards shall be all caps
|
||||
<namespace>\_<unit>
|
||||
+ make function forward declarations explicitly `extern`
|
||||
|
||||
// ### Macros ###
|
||||
### Macros ###
|
||||
+ only with consensus can any new macro be added to the codebase
|
||||
+ always parenthesize values
|
||||
|
||||
// ### Header Guards ###
|
||||
+ #define type
|
||||
+ all caps
|
||||
'<namespace>_<unit>'
|
||||
|
||||
// ### Identaion ###
|
||||
### Identaion ###
|
||||
+ tabs
|
||||
+ max 4 levels
|
||||
|
||||
// ### Parenthesizing ###
|
||||
### Parenthesizing ###
|
||||
+ do not parenthesize return statements
|
||||
+ always add spacing around when after a control statement { if (condition) {...} }
|
||||
+ do not pad the insides { (stuff) ; and not: ( stuff ) }
|
||||
+ do not pad after function context { myfun(); }
|
||||
+ always use to avoid relying on operator precedence { (a * b) + c }
|
||||
+ always add spacing around when after a control statement { `if (condition) {...}` }
|
||||
+ do not pad the insides { `(stuff) ; and not: ( stuff )` }
|
||||
+ do not pad after function context { `myfun();` }
|
||||
+ always use to avoid relying on operator precedence { `(a * b) + c` }
|
||||
|
||||
// ### Declarations ###
|
||||
+ pointer '*'s always to the middle { char * s; }
|
||||
+ dont concat pointer '*'s { char * * s; }
|
||||
### Declarations ###
|
||||
+ pointer '\*'s always to the middle { `char * s;` }
|
||||
+ dont concat pointer '\*'s { `char \* \* s;` }
|
||||
+ function heads belong on the same line
|
||||
+ [static|extern] [inline] [type]
|
||||
+ align adjecent ones horizontally
|
||||
+ always typedef structs or make them anonymous
|
||||
|
||||
// ### If ###
|
||||
### If ###
|
||||
+ align logical operators under the keyword if
|
||||
if (a
|
||||
&& b
|
||||
@ -59,34 +58,30 @@
|
||||
if (a) // good
|
||||
if (a != 0) // bad
|
||||
|
||||
// ### Switch ###
|
||||
### Switch ###
|
||||
switch(...) {
|
||||
case ...: {
|
||||
} beak;
|
||||
}
|
||||
+ GNU range extensions allowed
|
||||
|
||||
// ### Loops ###
|
||||
### Loops ###
|
||||
+ declare the iterator inside the loop
|
||||
+ variables to use for iteration 'i' -> 'j' -> 'k'
|
||||
+ use "while(1)" for infinit loops
|
||||
+ no coma in condition unless its an assignment
|
||||
+ never ommit brackets at empyt loop bodies
|
||||
|
||||
// ### Operators ###
|
||||
+ prefer prefix crementors when possible { ++i }
|
||||
### Operators ###
|
||||
+ prefer prefix crementors when possible { `++i;` }
|
||||
+ use spaces (if you dont intuetively know what this means, kys)
|
||||
|
||||
|
||||
// ### Naming ###
|
||||
### Naming ###
|
||||
+ namer chooses spelling, consistency must follow
|
||||
+ snake_case
|
||||
+ *_t on all typedefs
|
||||
+ LOCAL variables shall be short enough to not use snake_case
|
||||
+ snake\_case
|
||||
+ \*\_t on all typedefs
|
||||
+ LOCAL variables shall be short enough to not use snake\_case
|
||||
|
||||
// ### Misc ###
|
||||
### Misc ###
|
||||
+ keep a line width of 80
|
||||
|
||||
// ------ //
|
||||
// chad.h //
|
||||
#define UNUSED(x) ((void)x)
|
Loading…
x
Reference in New Issue
Block a user