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