Initial commit.
This commit is contained in:
commit
b3988f4f12
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Style Guide
|
||||||
|
|
||||||
|
This document lays out my general style guide when writing code, mostly in C.
|
||||||
|
|
||||||
|
## General Opinions
|
||||||
|
|
||||||
|
- Lines should try to be at most 80 columns.
|
||||||
|
- Four (4) spaces in a tab. No tab characters.
|
||||||
|
- THE POINTER GOES ON THE LEFT.
|
||||||
|
- Single line (`//`) comments for comments on the code. Multi-line (`/**/`) for
|
||||||
|
other things, e.g. examples, algorithm explanations, narratives, &c.
|
||||||
|
|
||||||
|
## Line Breaks
|
||||||
|
|
||||||
|
In general, keep things on as few lines as possible / legible. Obviously, this
|
||||||
|
means function declarations should be on one line if possible. Keep as best as
|
||||||
|
possible to an 80-column limit.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```C
|
||||||
|
looooooooooooooooooong type
|
||||||
|
llllllllllong_function_name(with a, lot of, arguments* h) {
|
||||||
|
return something;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```C
|
||||||
|
// Skip all whitespace.
|
||||||
|
while (*inp == ' ' || *inp == '\t') inp++;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Comment Style
|
||||||
|
|
||||||
|
In comments, when mentioning things *in* the code, use backticks (`\`\``).
|
Loading…
x
Reference in New Issue
Block a user